temporal-worker-k8s

Temporal Worker

Channel Revision Published Runs on
latest/stable 23 06 May 2025
Ubuntu 22.04
latest/edge 23 18 Apr 2025
Ubuntu 22.04
1.0/edge 31 Yesterday
Ubuntu 22.04
juju deploy temporal-worker-k8s
Show information

Platform:

charms.temporal_worker_k8s.v0.temporal_worker_consumer

Charm library for the temporal-worker-info Juju relation.

temporal-worker-info parallels temporal-host-info: the worker charm provides the namespace and task queue it serves so downstream charms know where to run workflows.

  • Import :class:TemporalWorkerInfoProvider in the temporal-worker charm and instantiate it once; it publishes namespace and queue from config into each related application's relation data (leader only).

  • Import :class:TemporalWorkerInfoRequirer in charms that relate to one or more workers. Use :meth:TemporalWorkerInfoRequirer.is_ready to decide when data is present; observe on.temporal_worker_info_available to react to updates. The importing charm should set unit status, not the library.


class TemporalWorkerInfoProvider

Description

Publish namespace and queue on the temporal-worker-info interface (provider side). None

Methods

TemporalWorkerInfoProvider. __init__( self , charm: CharmBase )

Create a new instance of the TemporalWorkerInfoProvider class.

Arguments

charm

The charm that is using this interface.

class TemporalWorkerInfoRelationReadyEvent

Event emitted when temporal-worker-info relation is ready for one relation.

Attributes

namespace
Temporal namespace from the provider application's relation data.
queue
Task queue name from the provider application's relation data.
relation_id
Juju relation id for this event source, if multiple relations exist.

Methods

TemporalWorkerInfoRelationReadyEvent. __init__( self , handle: Handle , namespace: str , queue: str , relation_id )

Initialize temporal-worker-info ready event.

Arguments

handle

Event handle.

namespace

Temporal namespace from relation data.

queue

Worker queue from relation data.

relation_id

Juju relation id when multiple worker relations exist.

TemporalWorkerInfoRelationReadyEvent. snapshot( self )

Serialize event state for the framework.

Returns

Mapping with namespace, queue, and optional relation_id keys.

TemporalWorkerInfoRelationReadyEvent. restore( self , snapshot )

Restore event state from a snapshot.

Arguments

snapshot

Data previously returned by :meth:snapshot.

class TemporalWorkerInfoRequirerCharmEvents

Events for the temporal-worker-info requirer.

Attributes

temporal_worker_info_available
Fired when provider data is present for a relation.

class TemporalWorkerInfoRequirer

Requirer side: read namespace/queue published by temporal-worker (one or more relations).

Attributes

on
Custom events for this relation interface.
charm
The requirer :class:`~ops.charm.CharmBase` instance.
relations
All ``temporal-worker-info`` :class:`~ops.model.Relation` instances for this charm.
namespace
First complete namespace from a related worker; use :meth:`relation_payloads` if multiple workers are related.
queue
Task queue matching :attr:`namespace` from the same relation.

Methods

TemporalWorkerInfoRequirer. __init__( self , charm: CharmBase )

Create a new instance of the TemporalWorkerInfoRequirer class.

Arguments

charm

The charm that is using this interface.

TemporalWorkerInfoRequirer. relations( self )

Return all Juju relations for this interface name.

Returns

List of :class:~ops.model.Relation instances (may be empty).

TemporalWorkerInfoRequirer. is_ready( self , relation_id )

Return whether namespace and queue are present in relation data.

Arguments

relation_id

If set, only that relation is checked. If None, return True when at least one related application has both keys set.

Returns

True if the requested scope has complete provider data.

TemporalWorkerInfoRequirer. relation_payloads( self )

Collect namespace and queue for every relation that has both keys.

Returns

Mapping from relation id to {"namespace": ..., "queue": ...}.

TemporalWorkerInfoRequirer. get_namespace_queue( self , relation_id: int )

Return namespace and queue for a specific relation id.

Arguments

relation_id

Juju id of the temporal-worker-info relation instance.

Returns

(namespace, queue) from the remote application's data bag, or (None, None) if the relation is missing or incomplete.

TemporalWorkerInfoRequirer. namespace( self )

Namespace from the first related worker that has both keys set.

Returns

Namespace string, or None if no relation has complete data. For multiple workers use :meth:relation_payloads or :meth:get_namespace_queue.

TemporalWorkerInfoRequirer. queue( self )

Queue from the same relation as :attr:namespace.

Returns

Queue string, or None if no relation has complete data.