adam.runnable_manager module

runnable_manager.py

class adam.runnable_manager.RunnableManager(runnables_module, runnables, project_uuid, do_timing=True, multi_threaded=True)

Bases: object

Class for managing the state of a set of runnables. Responsible for submitting them, tracking and exposing their status during propagation, and retrieving their results.

WARNING: this module is not thread-safe. The only supported simultaneous operation is calling get_latest_statuses() while a call to run() is ongoing.

__init__(runnables_module, runnables, project_uuid, do_timing=True, multi_threaded=True)

Sets up object that can manage the running and lifetime of the given batches.

Parameters
  • runnables_module – Object to use to communicate with server. Should be subclass of AdamObjects and should implement create, get, and update_with_results.

  • runnables (list<object>) – Runnable objects to be run/managed. Should implement get_uuid.

  • project_uuid (string) – The uuid of the project in which these runnables should be run.

  • do_timing (boolean) – If true, timing information will be printed for various parts of batch lifetime (submission, running, results retrieval).

  • multi_threaded (boolean) – If true, operations that would benefit from multithreading such as submission or results retrieval will be multithreaded. Should generally be left true, but can be set to false if a guaranteed particular ordering is necessary (e.g. for tests).

get_latest_statuses()

Retrieves the latest state of all runnables managed by this object. Safe to call while a call to update_state(), wait_for_completion() or run() is ongoing.

get_runnables()

Retrieves the runnables managed by this object. Not safe to call while any other call is ongoing.

run()
class adam.runnable_manager.State(value)

Bases: enum.Enum

An enumeration.

COMPLETED = 3
INITIALIZED = 1
SUBMITTED = 2