atomate.common package¶
Subpackages¶
Submodules¶
atomate.common.powerups module¶
This module defines general powerups that can be used for all workflows
-
atomate.common.powerups.
add_additional_fields_to_taskdocs
(original_wf, update_dict=None, task_name_constraint='ToDb')¶ For all XXToDbTasks in a given workflow, add information to “additional_fields” to be placed in the task doc.
- Args:
original_wf (Workflow) update_dict (Dict): dictionary to add additional_fields task_name_constraint (str): name of the Firetasks to be modified.
- Returns:
Workflow
-
atomate.common.powerups.
add_metadata
(wf, meta_dict, fw_name_constraint=None)¶ Add a metadata dictionary to a Workflow and all its Fireworks. The dictionary is merged into the “metadata” key of the Workflow and into the “_spec” key of each Firework in the workflow.
Can be used in combination with add_additional_fields_to_taskdocs to add the same set of key-value pairs to Workflows, Fireworks and Tasks collections.
- Args:
wf (Workflow) meta_dict: dictionary of custom metadata
- Returns:
Workflow
-
atomate.common.powerups.
add_namefile
(original_wf: fireworks.core.firework.Workflow, use_slug: bool = True) → fireworks.core.firework.Workflow¶ Every FireWork begins by writing an empty file with the name “FW–<fw.name>-<fw.fw_id>”. This makes it easy to figure out what jobs are in what launcher directories, e.g. “ls -l launch*/FW–*” from within a “block” dir.
- Args:
original_wf (Workflow) use_slug (bool): whether to replace whitespace-type chars with a slug.
Defaults to True.
- Returns:
Workflow
-
atomate.common.powerups.
add_priority
(original_wf, root_priority, child_priority=None)¶ Adds priority to a workflow
- Args:
original_wf (Workflow): original WF root_priority (int): priority of first (root) job(s) child_priority(int): priority of all child jobs. Defaults to
root_priority
- Returns:
Workflow: priority-decorated workflow
Adds tags to all Fireworks in the Workflow, WF metadata, as well as additional_fields for the Drone to track them later (e.g. tag all fireworks and tasks related to a specific research project).
Tags are written to the “_spec” key of each Firework in the workflow and to the “metadata.tags” key of each Workflow. If the workflow contains any Firetasks ending in “ToDb”, e.g. VaspToDb, QChemToDb, etc., then the tags are also passed as “additional_fields” to these tasks and included in the resulting task documents.
- Args:
original_wf (Workflow) tags_list: list of tags parameters (list of strings)
- Returns:
Workflow
-
atomate.common.powerups.
powerup_by_kwargs
(original_wf: fireworks.core.firework.Workflow, powerup_dicts: List[dict])¶ apply powerups in the form using a list of dictionaries [
{“powerup_name” : powerup_function1, “kwargs”: {parameter1 : value1, parameter2: value2}}, {“powerup_name” : powerup_function2, “kwargs”: {parameter1 : value1, parameter2: value2}},
]
- As an example:
- power_up_by_kwargs([
- {“powerup_name”“add_additional_fields_to_taskdocs”,
“kwargs: {“update_dict” : {“foo” : “bar”}}} ]
)
- Args:
original_wf: workflow that will be changed powerup_dicts: dictionary containing the powerup_name and kwarg.
if “.” is present in the name it will be imported as a full path if not we will use standard atomate modules where the powerups are kept
-
atomate.common.powerups.
preserve_fworker
(original_wf, fw_name_constraint=None)¶ set _preserve_fworker spec of Fireworker(s) of a Workflow. Can be used to pin a workflow to the first fworker it is run with. Very useful when running on multiple machines that can’t share files. fw_name_constraint can be used to only preserve fworker after a certain point where file passing becomes important
- Args:
original_wf (Workflow): fw_name_constraint (str): name of the Fireworks to be tagged (all if None is passed)
- Returns:
Workflow: modified workflow with specified Fireworkers tagged
-
atomate.common.powerups.
set_execution_options
(original_wf, fworker_name=None, category=None, fw_name_constraint=None, task_name_constraint=None)¶ set _fworker spec of Fireworker(s) of a Workflow. It can be used to specify a queue; e.g. run large-memory jobs on a separate queue.
- Args:
original_wf (Workflow): fworker_name (str): user-defined tag to be added under fw.spec._fworker
e.g. “large memory”, “big”, etc
category (str): category of FWorker that should pul job fw_name_constraint (str): name of the Fireworks to be tagged (all if
None is passed)
- task_name_constraint (str): name of the Firetasks to be tagged (e.g.
None or ‘RunVasp’)
- Returns:
Workflow: modified workflow with specified Fireworkers tagged
-
atomate.common.powerups.
set_queue_adapter
(original_wf: fireworks.core.firework.Workflow, queueadapter: dict = None, fw_name_constraint: str = None, task_name_constraint: str = None) → fireworks.core.firework.Workflow¶ set _queueadapter spec of Fireworker(s) of a Workflow. It can be used to change the overall queueadapter during the run.
- Args:
original_wf (Workflow): workflow that will be changed queueadapter (dict): dict to change _queueadapter fw_name_constraint (str): name of the Fireworks to be tagged (all if None is passed) task_name_constraint (str): name of the Firetasks to be tagged (e.g. None or ‘RunVasp’)
- Returns:
Workflow: modified workflow with specified Fireworkers tagged