temporal
Experimental. For evaluation. Interfaces, configuration, and behavior may change incompatibly.
Provides workflow identity helpers, scheduling, event entrypoints and host workflow cancellation.
Prerequisites
- None.
Setup
- Loads automatically; no configuration needed.
This module provides functionality for interacting with Temporal.
Members
- cancel_host_workflows
- hostname
- on_circuit_breaker_toggled
- on_workflow_toggle
- run_id
- schedule
- url
- workflow_id
cancel_host_workflows
temporal.cancel_host_workflows(hostname, script_name?, exclude_self?, wait_timeout?)Cancel running script workflows for a single host. Matches by the Hostname search attribute (workflows started without it are skipped) and triggers on_cancel handlers. Can only be called from within a Temporal workflow.
hostnamestringTarget hostname (e.g., ‘node-001’).script_name?optionalstringOnly cancel workflows from this script (e.g., ‘breakfix.star’). Empty cancels all matching workflows.exclude_self?optionalboolIf true, skip the calling workflow even if its ID matches the hostname. Prevents accidental self-cancellation.wait_timeout?optionalstringMax total time for on_cancel handlers to finish, parallel (e.g. ’30s’, ‘5m’, ‘72h’). Use ‘0’ for fire-and-forget.cancelled_idslist[string]List of workflow IDs that were cancelled. Use len() for the count.hostname
temporal.hostname()Gets the hostname of the Remediation Orchestrator instance. This is configured via the MAESTRO_HOSTNAME environment variable.
hostnamestringThe hostname of the Remediation Orchestrator instance.on_circuit_breaker_toggled
temporal.on_circuit_breaker_toggled(name, workflow, target_script?, target_workflow?, args?)Register a callback workflow to be launched when a circuit breaker trips or resets. Cannot be called from within a Temporal workflow.
namestringThe name of the entrypointworkflowworkflows.WorkflowThe workflow object to register the entrypoint fortarget_script?optionalstringThe script name to monitor for circuit breaker state changes (e.g., ‘monitoring.star’). Leave empty to monitor all scripts.target_workflow?optionalstringThe workflow name to monitor for circuit breaker state changes (e.g., ‘health_check’). Leave empty to monitor all workflows.args?optionaldict[string:any]The arguments to pass to the workflow.on_workflow_toggle
temporal.on_workflow_toggle(name, workflow, target_script?, target_workflow?, args?)Register a callback workflow to be launched when a workflow is enabled or disabled through the Remediation Orchestrator UI. Cannot be called from within a Temporal workflow.
namestringThe name of the entrypointworkflowworkflows.WorkflowThe workflow object to register the entrypoint fortarget_script?optionalstringThe script name to monitor for workflow toggles (e.g., ‘monitoring.star’). Leave empty to monitor all scripts.target_workflow?optionalstringThe workflow name to monitor for toggles (e.g., ‘health_check’). Leave empty to monitor all workflows.args?optionaldict[string:any]The arguments to pass to the workflow.run_id
temporal.run_id()Gets the run ID of the current workflow. Can only be called from within a Temporal workflow.
run_idstringThe run ID.schedule
temporal.schedule(schedule_name, workflow, crons, args?, skip_indexing?, overlap?, catchup_window?)Creates a Temporal schedule for a workflow. Cannot be called from within a Temporal workflow. Polling schedules should set overlap=‘skip’ and a finite catchup_window.
schedule_namestringThe name of the schedule. This will be used in the Temporal schedule ID.workflowworkflows.WorkflowThe workflow object to schedule.cronslist[string]The cron expressions to schedule the workflow with.args?optionaldict[string:any]The arguments to pass to the workflow.skip_indexing?optionalboolIf true, runs started by this schedule are flagged skip_indexing=true: the indexer does not pull events into script_workflow_events and the run uses the shorter SkippedWorkflowRetention. Use for high-frequency internal schedules whose per-run history is not needed in the workflow runs dashboard. Defaults to false.overlap?optionalstringOverlap policy. Empty preserves the existing default; ‘skip’ prevents a new run while the prior run is active.catchup_window?optionalstringFinite duration in which a missed action may catch up. Empty preserves the existing default.scheduletemporal.ScheduleThe schedule object.url
temporal.url()Gets the URL to the Temporal UI for the current workflow. Can only be called from within a Temporal workflow.
urlstringThe URL to the Temporal UI.workflow_id
temporal.workflow_id()Gets the ID of the current workflow. Can only be called from within a Temporal workflow.
workflow_idstringThe workflow ID.