julee.util.temporal.decorators

Temporal decorators for automatically creating activities and workflow proxies

This module provides decorators that automatically: 1. Wrap protocol methods as Temporal activities 2. Generate workflow proxy classes that delegate to activities Both reduce boilerplate and ensure consistent patterns.

Attributes

Functions

temporal_activity_registration(activity_prefix)

Class decorator that wraps async protocol methods as Temporal activities.

temporal_workflow_proxy(activity_base[, ...])

Class decorator that automatically creates workflow proxy methods that

Module Contents

julee.util.temporal.decorators.temporal_activity_registration(activity_prefix)[source]

Class decorator that wraps async protocol methods as Temporal activities.

This decorator inspects the class and wraps all async methods (coroutine functions) that don’t start with underscore as Temporal activities. The activity names are generated using the provided prefix and the method name.

Parameters:

activity_prefix (str) – Prefix for activity names (e.g., “sample.payment_repo.minio”). Method names will be appended to create full activity names like “sample.payment_repo.minio.process_payment”

Returns:

The decorated class with all async methods wrapped as Temporal activities

Return type:

collections.abc.Callable[[type[T]], type[T]]

Example

@temporal_activity_registration(“sample.payment_repo.minio”) class TemporalMinioPaymentRepository(MinioPaymentRepository):

pass

# This automatically creates activities for all protocol methods: # - process_payment -> “sample.payment_repo.minio.process_payment” # - get_payment -> “sample.payment_repo.minio.get_payment” # - refund_payment -> “sample.payment_repo.minio.refund_payment”

julee.util.temporal.decorators.temporal_workflow_proxy(activity_base, default_timeout_seconds=30, retry_methods=None)[source]

Class decorator that automatically creates workflow proxy methods that delegate to Temporal activities.

This decorator inspects the protocol/interface being implemented and generates methods that call workflow.execute_activity with the appropriate activity names, timeouts, and retry policies.

Parameters:
  • activity_base (str) – Base activity name (e.g., “julee.document_repo.minio”)

  • default_timeout_seconds (int) – Default timeout for activities in seconds

  • retry_methods (list[str] | None) – List of method names that should use retry policies

Returns:

The decorated class with all protocol methods implemented as workflow activity calls

Return type:

collections.abc.Callable[[type[T]], type[T]]

Example

@temporal_workflow_proxy(

“julee.document_repo.minio”, default_timeout_seconds=30, retry_methods=[“save”, “generate_id”]

) class WorkflowDocumentRepositoryProxy(DocumentRepository):

pass

# This automatically creates workflow methods for all methods: # - get() -> calls “julee.document_repo.minio.get” activity # - save() -> calls “julee.document_repo.minio.save” with retry # - generate_id() -> calls “julee.document_repo.minio.generate_id” with retry

julee.util.temporal.decorators.T[source]
julee.util.temporal.decorators.logger[source]