class documentation
class SimplePlugin(temporalio.client.Plugin, temporalio.worker.Plugin): (source)
Known subclasses: temporalio.contrib.openai_agents.OpenAIAgentsPlugin, temporalio.contrib.opentelemetry.OpenTelemetryPlugin
Constructor: SimplePlugin(name, data_converter, interceptors, activities, ...)
A simple plugin definition which has a limited set of configurations but makes it easier to produce a plugin which needs to configure them.
| Method | __init__ |
component for which they are applicable. All arguments are optional, and all but run_context can also be callables for more complex modification. See the type PluginParameter above. For details on each argument, see below. |
| Method | configure |
See base class. |
| Method | configure |
See base class. |
| Method | configure |
See base class. |
| Async Method | connect |
See base class. |
| Method | name |
See base class. |
| Async Method | run |
See base class. |
| Async Method | run |
See base class. |
| Instance Variable | activities |
Undocumented |
| Instance Variable | data |
Undocumented |
| Instance Variable | interceptors |
Undocumented |
| Instance Variable | nexus |
Undocumented |
| Instance Variable | run |
Undocumented |
| Instance Variable | workflow |
Undocumented |
| Instance Variable | workflow |
Undocumented |
| Instance Variable | workflows |
Undocumented |
| Instance Variable | _name |
Undocumented |
def __init__(self, name:
str, *, data_converter: PluginParameter[ temporalio.converter.DataConverter] = None, interceptors: Sequence[ temporalio.client.Interceptor | temporalio.worker.Interceptor] | None = None, activities: PluginParameter[ Sequence[ Callable]] = None, nexus_service_handlers: PluginParameter[ Sequence[ Any]] = None, workflows: PluginParameter[ Sequence[ type]] = None, workflow_runner: PluginParameter[ WorkflowRunner] = None, workflow_failure_exception_types: PluginParameter[ Sequence[ type[ BaseException]]] = None, run_context: Callable[ [], AbstractAsyncContextManager[ None]] | None = None):
(source)
¶
overridden in
temporalio.contrib.openai_agents.OpenAIAgentsPlugin, temporalio.contrib.opentelemetry.OpenTelemetryPlugin- Create a simple plugin with configurable parameters. Each of the parameters will be applied to any
- component for which they are applicable. All arguments are optional, and all but run_context can also be callables for more complex modification. See the type PluginParameter above. For details on each argument, see below.
| Parameters | |
name:str | The name of the plugin. |
dataPluginParameter[ | Data converter for serialization, or callable to customize existing one. Applied to the Client and Replayer. |
interceptors:Sequence[ | Interceptors to append. Client interceptors are applied to the Client, worker interceptors are applied to the Worker and Replayer. Interceptors that implement both interfaces will be applied to both, with exactly one instance used per worker to avoid duplication. |
activities:PluginParameter[ | Activity functions to append, or callable to customize existing ones. Applied to the Worker. |
nexusPluginParameter[ | Nexus service handlers to append, or callable to customize existing ones. Applied to the Worker. |
workflows:PluginParameter[ | Workflow classes to append, or callable to customize existing ones. Applied to the Worker and Replayer. |
workflowPluginParameter[ | Workflow runner, or callable to customize existing one. Applied to the Worker and Replayer. |
workflowPluginParameter[ | Exception types for workflow failures to append, or callable to customize existing ones. Applied to the Worker and Replayer. |
runCallable[ | A place to run custom code to wrap around the Worker (or Replayer) execution. Specifically, it's an async context manager producer. Applied to the Worker and Replayer. |
| Returns | |
| A configured Plugin instance. |
async def connect_service_client(self, config:
ConnectConfig, next: Callable[ [ ConnectConfig], Awaitable[ ServiceClient]]) -> temporalio.service.ServiceClient:
(source)
¶
See base class.
async def run_replayer(self, replayer:
Replayer, histories: AsyncIterator[ WorkflowHistory], next: Callable[ [ Replayer, AsyncIterator[ WorkflowHistory]], AbstractAsyncContextManager[ AsyncIterator[ WorkflowReplayResult]]]) -> AsyncIterator[ AsyncIterator[ WorkflowReplayResult]]:
(source)
¶
overrides
temporalio.worker.Plugin.run_replayerSee base class.