adaptivemd.WorkerScheduler¶
-
class
adaptivemd.
WorkerScheduler
(resource, verbose=False)[source]¶ A single instance worker scheduler to interprete Task objects
Parameters: - resource (Resource) – the resourse this scheduler should use.
- verbose (bool) – if True the worker will report lots of stuff
-
__init__
(resource, verbose=False)[source]¶ A single instance worker scheduler to interprete Task objects
Parameters: - resource (Resource) – the resourse this scheduler should use.
- verbose (bool) – if True the worker will report lots of stuff
Methods
__init__
(resource[, verbose])A single instance worker scheduler to interprete Task objects add_event
(event)advance
()Advance checking if tasks are completed or failed cancel_events
()Remove all pending events and stop them from further task execution change_state
(new_state)enter
([project])Call a preparations to use a scheduler exit
()Shut down the scheduler flatten_location
(obj)get_path
(f)Get the schedulers representation of the path in Location object on
(condition)Shortcut for creation and appending of a new Event release_queued_tasks
()Release captured tasks scheduled for execution (if not started yet) remove_task
(task)replace_prefix
(path)Interprete adaptive paths and replace prefixes with real os paths shut_down
([wait_to_finish])Do a controlled shutdown. stage_generators
()Prepare files and folder for all generators stage_in
(staging)stage_project
()Create paths necessary for the current project stop_current
()Stop execution of the current task immediately submit
(submission)Submit a Task or a Trajectory task_to_script
(task)Convert a task to an executable bash script trigger
()Trigger a check of state changes that leads to task execution unroll_staging_path
(location)Convert a staging location into an adaptiveMD location wait
()Wait until no more units are running and hence no more state changes Attributes
current_task_dir
Return the current path to the worker directory :returns: the path or None if no task is executed at the time :rtype: str or None folder_name
generators
Return the generators of the attached project is_idle
path
staging_area_location
-
__init__
(resource, verbose=False)[source] A single instance worker scheduler to interprete Task objects
Parameters: - resource (Resource) – the resourse this scheduler should use.
- verbose (bool) – if True the worker will report lots of stuff
-
task_to_script
(task)[source]¶ Convert a task to an executable bash script
Parameters: task (Task) – the Task instance to be converted Returns: a list of bash commands Return type: list of str
-
submit
(submission)[source]¶ Submit a Task or a Trajectory
Parameters: submission ((list of) Task or Trajectory) – Returns: the list of tasks actually executed after looking at all objects Return type: list of Task
-
current_task_dir
¶ Return the current path to the worker directory :returns: the path or None if no task is executed at the time :rtype: str or None
-
stop_current
()[source]¶ Stop execution of the current task immediately
Returns: if True the current task was cancelled, False if there was no task running Return type: bool
-
advance
()[source]¶ Advance checking if tasks are completed or failed
Needs to be called in regular intervals. Usually by the main worker instance
-
release_queued_tasks
()[source]¶ Release captured tasks scheduled for execution (if not started yet)
You can prefetch tasks (although not recommended for single workers) and this releases not started jobs back to the queue
-
enter
(project=None)[source]¶ Call a preparations to use a scheduler
Parameters: project (Project) – the project the worker should execute for