adaptivemd.Worker¶
-
class
adaptivemd.Worker(walltime=None, generators=None, sleep=None, heartbeat=None, prefetch=1, verbose=False)[source]¶ A Worker instance the will submit tasks from the DB to a scheduler
-
__init__(walltime=None, generators=None, sleep=None, heartbeat=None, prefetch=1, verbose=False)[source]¶
Methods
__init__([walltime, generators, sleep, ...])args()Return a list of args of the __init__ function of a class base()Return the most parent class actually derived from StorableMixin create(project)descendants()Return a list of all subclassed objects execute(command)Send and execute a single command to the worker from_dict(dct)get_uuid()Create a new unique ID idx(store)Return the index which is used for the object in the given store. named(name)Attach a .name property to an object objects()Returns a dictionary of all storable objects run()Start the worker to execute tasks until it is shut down shutdown([gracefully])Shut down the worker to_dict()Attributes
ACTIVE_LONGCREATION_COUNTINSTANCE_UUIDbase_clsReturn the base class base_cls_nameReturn the name of the base class clsReturn the class name as a string commandcurrentn_tasksprefetchprojectreturns: the currently used project schedulerreturns: the currently used scheduler to execute tasks seenstateverbose-
scheduler¶ Returns: the currently used scheduler to execute tasks Return type: WorkerScheduler
-
project¶ Returns: the currently used project Return type: Project
-
execute(command)[source]¶ Send and execute a single command to the worker
Note that the worker is registered on the DB but running on your HPC. Just loading it does not allow you to call functions like .shutdown. These would only be called on your local instance. All you can do is use execute which will store a command in the DB and once the real running worker executed it. The command will be cleared from the DB.
Parameters: command (str) – the command to be executed
-