citrine.jobs.waiting module

exception citrine.jobs.waiting.ConditionTimeoutError

Bases: RuntimeError

Error that is raised when timeout is reached but the checked condition is still False.

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

args
citrine.jobs.waiting.wait_for_asynchronous_object(*, resource: AsynchronousObject, collection: Collection[AsynchronousObject], print_status_info: bool = False, timeout: float = 1800.0, interval: float = 3.0) AsynchronousObject

Wait until an asynchronous object has finished.

This could be a module, workflow, workflow execution, or report.

Parameters:
  • resource (AsynchronousObject) – a module, workflow, workflow execution, or report to monitor

  • collection (Collection[AsynchronousObject]) – Collection containing the resource

  • print_status_info (bool) – Whether to print status info, by default False

  • timeout (float) – Maximum time spent waiting, in seconds, by default 1800.0

  • interval (float) – Inquiry interval in seconds, by default 3.0

Returns:

The resource after the asynchronous work has finished or timed out.

Return type:

AsynchronousObject

Raises:

ConditionTimeoutError – If fails to finish within timeout

citrine.jobs.waiting.wait_while_executing(*, collection: Collection[PredictorEvaluationExecution] | Collection[DesignExecution] | Collection[GenerativeDesignExecution] | Collection[SampleDesignSpaceExecution], execution: PredictorEvaluationExecution | DesignExecution | GenerativeDesignExecution | SampleDesignSpaceExecution, print_status_info: bool = False, timeout: float = 1800.0, interval: float = 3.0) PredictorEvaluationExecution | DesignExecution | GenerativeDesignExecution | SampleDesignSpaceExecution

Wait until execution is finished.

Parameters:
  • execution (Union[PredictorEvaluationExecution, DesignExecution]) – an execution to monitor

  • print_status_info (bool, optional) – Whether to print status info, by default False

  • timeout (float, optional) – Maximum time spent inquiring in seconds, by default 1800.0

  • interval (float, optional) – Inquiry interval in seconds, by default 3.0

  • collection (Union[Collection[PredictorEvaluationExecution], Collection[DesignExecution]]) – Collection containing executions

Returns:

the updated execution after it has finished executing

Return type:

Union[PredictorEvaluationExecution, DesignExecution]

Raises:

ConditionTimeoutError – If fails to finish execution within timeout

citrine.jobs.waiting.wait_while_validating(*, collection: Collection[AsynchronousObject], module: AsynchronousObject, print_status_info: bool = False, timeout: float = 1800.0, interval: float = 3.0) AsynchronousObject

Wait until module is validated.

Parameters:
  • collection (Collection[AsynchronousObject,]) – Collection containing module

  • module (AsynchronousObject,) – Module in Collection

  • print_status_info (bool, optional) – Whether to print status info, by default False

  • timeout (float, optional) – Maximum time spent inquiring in seconds, by default 1800.0

  • interval (float, optional) – Inquiry interval in seconds, by default 3.0

Returns:

Module in Collection after validation

Return type:

AsynchronousObject

Raises:

ConditionTimeoutError – If fails to validate within timeout