artificial.workflows.util#

actor_reference(
id: str,
ability_types: List[Tuple[str, type]],
display_name: str = '',
) ActorReference#
create_child_job(child, job_name: str)#

Takes a non-awaited call to a child workflow function and creates a child job of that workflow with the given arguments.

get_lab_config() Dict[str, str]#
get_org_config() Dict[str, str]#
get_workflow_config() Any#
priority(priority: int)#
reserve(actor_ref: str, actor_type: type, runtime_only: bool = False)#

Used in a with statement to create a spanlock over a block of actions, to limit the number of concurrent executions of that block within a lab.

Parameters:
  • actor_ref – An actor reference that defines the lock to reserve.

  • actor_type – A class associated with the spanlock name to reserve in the definition of actor_ref. The actor’s configuration must provide an ability name “exclusive_locks_<spanlock name>.

  • runtime_only – True for spanlocks that should only be reserved at runtime; False for spanlocks that should also be considered during schedule computation. The default is False for backwards compatibility; however, note that schedule-time spanlocks create significantly more overhead for the scheduler.

revocable(group_name: str)#

Used in a with statement to create a region of revocable assistants associated with the given group name. Non-assistant actions cannot appear in a revocable region.

If job A is ready to run actions in a revocable region with group name G, but job B starts running actions in a revoke region with group name G, then the revocable actions in job A will be revoked until the revoke actions of job B have completed.

Parameters:

group_name – the group name shared by related revoke and revocable regions.

revoke(group_name: str, grace_period: int)#

Used in a with statement to create a region of revoking actions associated with the given group name.

If job A is ready to run actions in a revocable region with group name G, but job B starts running actions in a revoke region with group name G, then the revocable actions in job A will be revoked until the revoke actions of job B have completed.

Parameters:
  • group_name – the group name shared by related revoke and revocable regions.

  • grace_period – the duration in seconds to allow before revoking actions. The total grace period will be the sum of the grace periods specified by all revoke regions in all jobs using the same group name.

spawn_child_job(child, job_name: str)#

Takes a non-awaited call to a child workflow function and creates and schedules a child job of that workflow with the given arguments.