Dispatcher
zenml.dispatcher
Event dispatcher for pipeline run lifecycle events.
Attributes
__all__ = ['EventDispatcher', 'EventHandler']
module-attribute
Classes
EventDispatcher()
Process-wide broadcaster of pipeline run lifecycle events.
Initialize the dispatcher with an empty handler list.
Source code in src/zenml/dispatcher/dispatcher.py
30 31 32 33 | |
Functions
handle_run_status_update(run: PipelineRunResponse) -> None
Handle a status update on a pipeline run.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
run
|
PipelineRunResponse
|
The pipeline run whose status has changed. |
required |
Source code in src/zenml/dispatcher/dispatcher.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | |
has_handlers() -> bool
Return True if any handlers are registered.
Returns:
| Type | Description |
|---|---|
bool
|
Whether the dispatcher would fan out to at least one handler. |
Source code in src/zenml/dispatcher/dispatcher.py
58 59 60 61 62 63 64 65 | |
register_event_handler(event_handler: EventHandler) -> None
Register an event handler.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event_handler
|
EventHandler
|
An event handler to register. |
required |
Source code in src/zenml/dispatcher/dispatcher.py
35 36 37 38 39 40 41 42 | |
unregister_event_handler(event_handler: EventHandler) -> None
Unregister a previously-registered event handler.
No-op if the handler isn't registered.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event_handler
|
EventHandler
|
The event handler instance to remove. |
required |
Source code in src/zenml/dispatcher/dispatcher.py
44 45 46 47 48 49 50 51 52 53 54 55 56 | |
EventHandler
Bases: ABC
Abstract base for handlers registered with EventDispatcher.
Functions
create() -> EventHandler
async
classmethod
Factory used by the source loader.
Needs to be implemented if a handler is specified via
server_config.event_handler_sources.
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
Always. |
Returns:
| Type | Description |
|---|---|
EventHandler
|
Handler instance. |
Source code in src/zenml/dispatcher/handler.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | |
handle_run_status_update(run: PipelineRunResponse) -> None
abstractmethod
Handle a status update on a pipeline run.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
run
|
PipelineRunResponse
|
The pipeline run whose status has changed. |
required |
Source code in src/zenml/dispatcher/handler.py
24 25 26 27 28 29 30 31 32 33 | |
Modules
dispatcher
Event dispatcher that fans out run lifecycle events to handlers.
Classes
EventDispatcher()
Process-wide broadcaster of pipeline run lifecycle events.
Initialize the dispatcher with an empty handler list.
Source code in src/zenml/dispatcher/dispatcher.py
30 31 32 33 | |
handle_run_status_update(run: PipelineRunResponse) -> None
Handle a status update on a pipeline run.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
run
|
PipelineRunResponse
|
The pipeline run whose status has changed. |
required |
Source code in src/zenml/dispatcher/dispatcher.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | |
has_handlers() -> bool
Return True if any handlers are registered.
Returns:
| Type | Description |
|---|---|
bool
|
Whether the dispatcher would fan out to at least one handler. |
Source code in src/zenml/dispatcher/dispatcher.py
58 59 60 61 62 63 64 65 | |
register_event_handler(event_handler: EventHandler) -> None
Register an event handler.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event_handler
|
EventHandler
|
An event handler to register. |
required |
Source code in src/zenml/dispatcher/dispatcher.py
35 36 37 38 39 40 41 42 | |
unregister_event_handler(event_handler: EventHandler) -> None
Unregister a previously-registered event handler.
No-op if the handler isn't registered.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event_handler
|
EventHandler
|
The event handler instance to remove. |
required |
Source code in src/zenml/dispatcher/dispatcher.py
44 45 46 47 48 49 50 51 52 53 54 55 56 | |
Functions
handler
Base classes for event handlers registered with the dispatcher.
Classes
EventHandler
Bases: ABC
Abstract base for handlers registered with EventDispatcher.
create() -> EventHandler
async
classmethod
Factory used by the source loader.
Needs to be implemented if a handler is specified via
server_config.event_handler_sources.
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
Always. |
Returns:
| Type | Description |
|---|---|
EventHandler
|
Handler instance. |
Source code in src/zenml/dispatcher/handler.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | |
handle_run_status_update(run: PipelineRunResponse) -> None
abstractmethod
Handle a status update on a pipeline run.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
run
|
PipelineRunResponse
|
The pipeline run whose status has changed. |
required |
Source code in src/zenml/dispatcher/handler.py
24 25 26 27 28 29 30 31 32 33 | |