autojob package

Tools for DFT job automation on massively parallel computing resources.

Subpackages

Submodules

autojob.hpc module

Interface with high performance computing resources.

class autojob.hpc.JobState(value)[source]

Bases: StrEnum

The state of a scheduler job.

The meanings of each state are defined in the sacct SLURM documentation (https://slurm.schedmd.com/sacct.html). The lone exception is “UNKNOWN”, which is applicable when the job accounting utility is not available.

BOOT_FAIL = 'BF'
CANCELLED = 'CA'
COMPLETED = 'CD'
DEADLINE = 'DL'
FAILED = 'F'
NODE_FAIL = 'NF'
OUT_OF_MEMORY = 'OOM'
PENDING = 'PD'
PREEMPTED = 'PR'
REQUEUED = 'RQ'
RESIZING = 'RS'
REVOKED = 'RV'
RUNNING = 'R'
SUSPENDED = 'S'
TIMEOUT = 'TO'
UNKNOWN = 'UNK'
class autojob.hpc.Partition(value)[source]

Bases: Enum

A partition on a computing cluster.

BIGMEM = 'bigmem'
CPU2013 = 'cpu2013'
CPU2017_BF05 = 'cpu2017-bf05'
CPU2019 = 'cpu2019'
CPU2019_BF05 = 'cpu2019-bf05'
CPU2021 = 'cpu2021'
CPU2021_BF05 = 'cpu2021-bf05'
CPU2021_BF24 = 'cpu2021-bf24'
CPU2022 = 'cpu2022'
CPU2022_BF24 = 'cpu2022-bf24'
CPU2023 = 'cpu2023'
GPU_V100 = 'gpu-v100'
LATTICE = 'lattice'
PARALLEL = 'parallel'
RAZI = 'razi'
SINGLE = 'single'
property cluster_name

The name of the cluster with underscores replaced with hyphens.

property cpus_per_node

The number of cores per node in the partition.

property gpu

Whether the partition is GPU-enabled.

property max_mem_per_node

The maximum memory per node on the partition.

property nodes

The number of nodes in the partition.

property time_limit

The maximum time limit for the partition.

pydantic model autojob.hpc.SchedulerInputs[source]

Bases: BaseModel

The inputs for the scheduler.

Attributes are named for convenience/intuitiveness. Aliases are provided for consistency with SLURM. Special validation for parsing values as provided to SLURM options is performed by default.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Show JSON schema
{
   "title": "SchedulerInputs",
   "description": "The inputs for the scheduler.\n\nAttributes are named for convenience/intuitiveness. Aliases\nare provided for consistency with SLURM. Special validation\nfor parsing values as provided to SLURM options is performed\nby default.",
   "type": "object",
   "properties": {
      "job-name": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Job-Name"
      },
      "account": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Account"
      },
      "partition": {
         "anyOf": [
            {
               "items": {
                  "$ref": "#/$defs/Partition"
               },
               "type": "array"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The partitions specified for the job",
         "title": "Partition"
      },
      "mem": {
         "anyOf": [
            {
               "type": "integer"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The memory requested per node in MB.",
         "title": "Mem"
      },
      "mem-per-cpu": {
         "anyOf": [
            {
               "type": "integer"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The memory requested per cpu in MB.",
         "title": "Mem-Per-Cpu"
      },
      "nodes": {
         "anyOf": [
            {
               "type": "integer"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Nodes"
      },
      "ntasks-per-node": {
         "anyOf": [
            {
               "type": "integer"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The number of cores per node",
         "title": "Ntasks-Per-Node"
      },
      "time": {
         "anyOf": [
            {
               "format": "duration",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The time requested for a job.",
         "title": "Time"
      },
      "mail-user": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Mail-User"
      },
      "mail-type": {
         "anyOf": [
            {
               "items": {
                  "type": "string"
               },
               "type": "array"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The list of conditions for which email notifications will be sent",
         "title": "Mail-Type"
      }
   },
   "$defs": {
      "Partition": {
         "description": "A partition on a computing cluster.",
         "enum": [
            "bigmem",
            "cpu2013",
            "cpu2017-bf05",
            "cpu2019",
            "cpu2019-bf05",
            "cpu2021",
            "cpu2021-bf05",
            "cpu2021-bf24",
            "cpu2022",
            "cpu2022-bf24",
            "cpu2023",
            "gpu-v100",
            "lattice",
            "parallel",
            "razi",
            "single"
         ],
         "title": "Partition",
         "type": "string"
      }
   }
}

Config:
  • populate_by_name: bool = True

  • alias_generator: function = <function hyphenate at 0x7fb785a6c180>

Fields:
Validators:
field account: str | None = None
field cores_per_node: int | None = None (alias 'ntasks-per-node')

The number of cores per node

field job_name: str | None = None (alias 'job-name')
field mail_type: list[str] | None = None (alias 'mail-type')

The list of conditions for which email notifications will be sent

Validated by:
field mail_user: str | None = None (alias 'mail-user')
field mem: Memory | None = None

The memory requested per node in MB.

field mem_per_cpu: Memory | None = None (alias 'mem-per-cpu')

The memory requested per cpu in MB.

field nodes: int | None = None
field partitions: list[Partition] | None = None (alias 'partition')

The partitions specified for the job

Validated by:
field time: Time | None = None

The time requested for a job.

classmethod from_directory(src: str | Path) SchedulerInputs[source]

Load scheduler inputs from Slurm file.

Parameters:

src – The directory to load inputs from.

Returns:

A SchedulerInputs dictionary.

validator validate_mail_type  »  mail_type[source]

Validate the mail_type option value.

validator validate_partitions  »  partitions[source]

Validate the partitions in the scheduler request.

static extract_scheduler_inputs(stream: TextIO | list[str]) dict[str, str][source]

Parse a slurm submission file to determine the slurm options.

Parameters:

stream – A TextIO containing the contents of the slurm submission file.

Returns:

A dictionary mapping slurm parameter names to parameter values.

Note that no validation/conversion is done to the field values. Conversion to valid (more useful) Python values can be performed using SchedulerInputs.model_validate.

static update_values(inputs: dict[str, Any], mods: dict[str, Any]) None[source]

Safely updates scheduler parameters subject to SLURM conditions.

This method modifies inputs in place.

Parameters:
  • inputs – A dictionary containing SchedulerInputs fields.

  • mods – A dictionary containing new values with which to update inputs. Note that only one of mem and mem_per_cpu can be set.

check_inputs() list[str][source]

Check that the scheduler request is valid.

serialize_mail_type(v: Any, _: SerializerFunctionWrapHandler, info: FieldSerializationInfo) list[str] | str | None[source]

Serialize the mail_type option value.

serialize_partitions(v: list[Partition], _: SerializerFunctionWrapHandler, info: FieldSerializationInfo) list[Partition] | str | None[source]

Serialize the partitions in the scheduler request.

pydantic model autojob.hpc.SchedulerOutputs[source]

Bases: BaseModel

The outputs from a scheduler task.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Show JSON schema
{
   "title": "SchedulerOutputs",
   "description": "The outputs from a scheduler task.",
   "type": "object",
   "properties": {
      "elapsed": {
         "anyOf": [
            {
               "format": "duration",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The job wall time.",
         "title": "Elapsed"
      },
      "idle_time": {
         "anyOf": [
            {
               "format": "duration",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The time required for the job to start after submission.",
         "title": "Idle Time"
      },
      "job_id": {
         "anyOf": [
            {
               "type": "integer"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Job Id"
      },
      "max_rss": {
         "anyOf": [
            {
               "type": "integer"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Maximum memory used by job.",
         "title": "Max Rss"
      },
      "nodes": {
         "default": [],
         "description": "The nodes on which the job ran.",
         "items": {
            "type": "string"
         },
         "title": "Nodes",
         "type": "array"
      },
      "partition": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The partition on which the job ran.",
         "title": "Partition"
      },
      "state": {
         "$ref": "#/$defs/JobState",
         "default": "UNK",
         "description": "The state of the scheduler job."
      }
   },
   "$defs": {
      "JobState": {
         "description": "The state of a scheduler job.\n\nThe meanings of each state are defined in the sacct SLURM documentation\n(https://slurm.schedmd.com/sacct.html). The lone exception is \"UNKNOWN\",\nwhich is applicable when the job accounting utility is not available.",
         "enum": [
            "BF",
            "CA",
            "CD",
            "DL",
            "F",
            "NF",
            "OOM",
            "PD",
            "PR",
            "R",
            "RQ",
            "RS",
            "RV",
            "S",
            "TO",
            "UNK"
         ],
         "title": "JobState",
         "type": "string"
      }
   },
   "additionalProperties": true
}

Config:
  • extra: str = allow

Fields:
Validators:
field elapsed: Time | None = None

The job wall time.

field idle_time: Time | None = None

The time required for the job to start after submission.

field job_id: int | None = None
field max_rss: Memory | None = None

Maximum memory used by job.

field nodes: list[str] = []

The nodes on which the job ran.

field partition: str | None = None

The partition on which the job ran.

field state: JobState = JobState.UNKNOWN

The state of the scheduler job.

Validated by:
classmethod from_directory(src: str | Path, use_cache: bool = False) SchedulerOutputs[source]

Load scheduler outputs from Slurm file.

Parameters:
  • src – The directory to load outputs from.

  • use_cache – Whether or not to use cached results. If True, then cached results will be ignored and overwritten. Otherwise, outputs will be read from an existing cache.

Returns:

A SchedulerOutputs dictionary.

validator validate_job_state  »  state[source]

Validate the job state from the value or name of a JobState.

autojob.hpc.convert(memory: float, from_units: str, to_units: str) float[source]

Convert memory denominations in binary.

Units can be specified using uppercase, lowercase, one-, or two-letter abbreviations. E.g., ‘K’, ‘k’, ‘KB’, ‘kb’ are all interpreted as kilobytes.

Parameters:
  • memory (float) – memory to be converted.

  • from_units (str) – The units from which memory is to be converted.

  • to_units (str) – The units to which memory is to be converted.

Returns:

float – The memory in the desired units.

autojob.hpc.get_scheduler_command(scheduler: str) str[source]

Return the command used to submit jobs to the scheduler.

Parameters:

scheduler – The name of the scheduler.

Raises:
autojob.hpc.serialize_memory(v: Any, _: FieldSerializationInfo) str | None[source]

Serialize the memory request into a SLURM-compatible format.

autojob.hpc.serialize_time(v: Any, _: FieldSerializationInfo) str | None[source]

Serialize the time request into a SLURM-compatible format.

autojob.hpc.validate_memory(v: Any, handler: ValidatorFunctionWrapHandler, _: ValidationInfo) int | None[source]

Validate the memory request.

autojob.hpc.validate_time(v: Any, handler: ValidatorFunctionWrapHandler, _: ValidationInfo) timedelta | None[source]

Validate the time request.

autojob.legacy module

Legacy classes.

Deprecated since version v.0.12.0b2.

class autojob.legacy.StudyType(value)[source]

Bases: Enum

A tyype of study.

ADSORPTION = 'adsorption'
DEFAULT = 'sensitivity'
MECHANISM = 'mechanism'
SENSITIVITY = 'sensitivity'
is_implemented() bool[source]

Whether or not a StudyType is implemented.

autojob.parametrizations module

Represent a reference to a variable.

class autojob.parametrizations.VariableReference(*, set_path: Annotated[list[str], FieldInfo(annotation=NoneType, required=True, metadata=[MinLen(min_length=1)])], get_path: Annotated[list[str], FieldInfo(annotation=NoneType, required=True, metadata=[MinLen(min_length=1)])] | None = None, get_paths: Annotated[list[Annotated[list[str], FieldInfo(annotation=NoneType, required=True, metadata=[MinLen(min_length=1)])]], FieldInfo(annotation=NoneType, required=True, metadata=[MinLen(min_length=1)])] | None = None, constant: Any = None, composer: Callable | None = None)[source]

Bases: Generic[_T]

A reference to a variable.

Variables:
  • set_path – A list of strings indicating the path to the variable to be set.

  • get_path – A list of strings indicating the path to the variable to be obtained.

  • get_paths – A list of lists of strings each indicating a path to a variable to be obtained.

  • constant – A value to be used to set the variable.

  • composer – A function that takes in an AttributePath and AttributePaths and returns a value.

Example: Evaluate the value of a VariableReference
>>> from autojob.parametrizations import VariableReference
>>> context = {
...     "a": {
...         "b": 4,
...     }
... }
>>> ref = VariableReference(
...     set_path=["a"],
...     get_path=["a", "b"],
...     constant=4,
... )
>>> ref.evaluate(context)
4
Example: Set a value using a VariableReference
>>> from autojob.parametrizations import VariableReference
>>> context = {
...     "a": {
...         "b": 4,
...     }
... }
>>> ref = VariableReference(
...     set_path=["a"],
...     get_path=["a", "b"],
...     constant=4,
... )
>>> class Object(object):
...     pass
>>> target_object = Object()
>>> target_dict = {}
>>> ref.set_input_value(context, target_object)
>>> target_object.a
4
>>> ref.set_input_value(context, target_dict)
>>> target_dict["a"]
4

Instantiate a VariableReference.

Parameters:
  • set_path – An AttributePath indicating the variable to set.

  • get_path – An AttributePath indicating the source variable. Defaults to None.

  • get_paths – A list of AttributePath s, each of which will be combined to the source variable. Defaults to None.

  • constant – A constant value used to set the variable. Defaults to None.

  • composer – A function that accepts the value of the source variable(s) and returns a value to be used to set the variable. Defaults to None.

evaluate(context: _Referenceable) _T[source]

Evaluate a variable reference in the given context.

Parameters:

context – A dictionary (or object) containing values to be used to evaluate the VariableReference.

Raises:
Returns:

The value.

set_input_value(context: dict[str, Any], shell: _Referenceable) None[source]

Set the value of a key specified by the VariableReference.

This method modifies shell in place.

Parameters:
  • context – A dictionary containing values to be used to evaluate the VariableReference.

  • shell – A dictionary or object containing values to be set.

autojob.parametrizations.create_parametrization(previous: TaskBase, calc_mods: dict[str, Any] | None = None, sched_mods: dict[str, Any] | None = None, exclude_metadata: Iterable[str] | None = None) list[VariableReference[Any]][source]

Create a parametrization from parameter mod and a previous task.

Parameters:
  • previous – A calculation.Calculation representing the previous calculation.

  • calc_mods – A dictionary containing modifications to calculator parameters. Defaults to an empty dictionary.

  • sched_mods – A dictionary containing modifications to scheduler inputs. Defaults to an empty dictionary.

  • exclude_metadata – A list of metadata fields to exclude from the parametrization.

Returns:

A list of VariableReference s that can be used to set the values of the new calculation.

Warning

When specifying sched_mods, be wary of setting mutually exclusive scheduler parameters (e.g, mem and mem_per_cpu or cores and cores_per_node). For example, if the mem parameter is set and one wants to set the mem_per_cpu parameter, set the mem key to Unset in sched_mods in addition to setting the mem_per_cpu key.

autojob.parametrizations.getattrpath(obj: _Referenceable, path: Iterable[str]) Any[source]

Access an attribute or dictionary value with an attribute path.

Parameters:
  • obj – A dictionary or object.

  • path – A iterable of strings indicating the sequence of attributes or dictionary keys pointing to the value to get.

Returns:

The attribute or dictionary value.

autojob.plugins module

This module loads and stores all registered plugins.

In particular, this module loads task, analysis, and harvest plugins.

autojob.plugins.discover_analysis_plugins() None[source]

Discover analyses registred through entry points.

autojob.plugins.discover_harvester_plugins() None[source]

Discover harvesters registred through entry points.

autojob.plugins.discover_task_plugins() None[source]

Discover tasks registred through entry points.

autojob.plugins.get_analysis(analysis: str) AnalysisBase[source]

Return an installed analysis.

Raises:

KeyError – The requested analysis is not installed.

autojob.plugins.get_harvester(harvester: str) HarvesterBase[source]

Return an installed harvester.

Raises:

KeyError – The requested harvester is not installed.

autojob.plugins.get_task_class(task_class: str) type[TaskBase][source]

Return an installed task class.

Raises:

KeyError – The requested task class is not installed.

autojob.plugins.register_plugin(name: str, plugin: Any, plugin_type: Literal['analysis', 'harvester', 'task_class']) None[source]

Register a plugin.

Parameters:
  • name – The name used to store the plugin.

  • plugin – The plugin.

  • plugin_type – The type of plugin to be registered.

Raises:

autojob.settings module

Global settings and configuration for autojob.

pydantic settings autojob.settings.AutojobSettings[source]

Bases: BaseSettings

Settings for autojob.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Show JSON schema
{
   "title": "AutojobSettings",
   "description": "Settings for ``autojob``.",
   "type": "object",
   "properties": {
      "INPUT_ATOMS_FILE": {
         "default": "in.traj",
         "description": "the default filename to use for the input Atoms file",
         "title": "Input Atoms File",
         "type": "string"
      },
      "INPUTS_FILE": {
         "default": "inputs.json",
         "description": "the default filename to use for the input parameters file",
         "title": "Inputs File",
         "type": "string"
      },
      "TASK_SCRIPT": {
         "default": "run.py",
         "description": "the default filename to use for the python script",
         "title": "Task Script",
         "type": "string"
      },
      "SLURM_SCRIPT": {
         "default": "vasp.sh",
         "description": "the default filename to use for the SLURM script",
         "title": "Slurm Script",
         "type": "string"
      },
      "DEFAULT_TASK_SCRIPT_FILE": {
         "default": "run.sh",
         "description": "the default filename to use for the task script",
         "title": "Default Task Script File",
         "type": "string"
      },
      "DEFAULT_CALCULATION_SCRIPT_FILE": {
         "default": "run.py",
         "description": "the default filename to use for the calculation script",
         "title": "Default Calculation Script File",
         "type": "string"
      },
      "OUTPUT_ATOMS_FILE": {
         "default": "final.traj",
         "description": "the default filename to use for the output Atoms file",
         "title": "Output Atoms File",
         "type": "string"
      },
      "SCHEDULER_STATS_FILE": {
         "default": "job_stats.json",
         "description": "the default filename to use for the job stats file",
         "title": "Scheduler Stats File",
         "type": "string"
      },
      "ARCHIVE_FILE": {
         "default": "task.json",
         "description": "the default filename to use to archive harvested tasks",
         "title": "Archive File",
         "type": "string"
      },
      "TASK_METADATA_FILE": {
         "default": "job.json",
         "description": "the default filename to use to store task metadata",
         "title": "Task Metadata File",
         "type": "string"
      },
      "TASK_GROUP_METADATA_FILE": {
         "default": "calculation.json",
         "description": "the default filename to use to store task group metadata",
         "title": "Task Group Metadata File",
         "type": "string"
      },
      "STUDY_METADATA_FILE": {
         "default": "study.json",
         "description": "the default filename to use to store study metadata",
         "title": "Study Metadata File",
         "type": "string"
      },
      "STUDY_GROUP_METADATA_FILE": {
         "default": "study_group.json",
         "description": "the default filename to use to store study group metadata",
         "title": "Study Group Metadata File",
         "type": "string"
      },
      "RECORD_FILE": {
         "default": "record.txt",
         "description": "the default filename to use to store the study record",
         "title": "Record File",
         "type": "string"
      },
      "WORKFLOW_FILE": {
         "default": "workflow.json",
         "description": "the default filename to use to store study workflow data",
         "title": "Workflow File",
         "type": "string"
      },
      "PARAMETRIZATION_FILE": {
         "default": "parametrizations.json",
         "description": "the default filename to use to store study parametrization data",
         "title": "Parametrization File",
         "type": "string"
      },
      "TEMPLATE_DIR": {
         "anyOf": [
            {
               "format": "path",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "If not None, specifies the directory to use to load templates",
         "title": "Template Dir"
      },
      "TASK_SCRIPT_TEMPLATE": {
         "default": "run.sh.j2",
         "description": "the name of the default scheduler script template to use",
         "title": "Task Script Template",
         "type": "string"
      },
      "CALCULATION_SCRIPT_TEMPLATE": {
         "default": "run.py.j2",
         "description": "the name of the default task script template to use",
         "title": "Calculation Script Template",
         "type": "string"
      },
      "SCHEDULER": {
         "default": "slurm",
         "description": "the name of the scheduler to use",
         "title": "Scheduler",
         "type": "string"
      },
      "LOG_FILE": {
         "anyOf": [
            {
               "format": "path",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The filename for the log file. Note that this variable is mainly for storing state for application-like use. If you are using autojob as a library, you may be better served configuring handlers.",
         "title": "Log File"
      },
      "LOG_LEVEL": {
         "default": 10,
         "description": "The default log level.",
         "title": "Log Level"
      },
      "STRICT_MODE": {
         "default": true,
         "description": "Sets the default behaviour of data retrieval functions and methods. If True, such functions will raise errors when they fail. Otherwise, failure will pass with a log message only. This may be useful if you are harvesting the results of incomplete tasks.",
         "title": "Strict Mode",
         "type": "boolean"
      },
      "LEGACY_MODE": {
         "default": true,
         "description": "Sets the format study group, study, task group, and task IDs. If True, said IDs will be 10-character alphanumerics prefixed by single letters (g, s, c, j, respectively). IDs will be UUID4s otherwise.",
         "title": "Legacy Mode",
         "type": "boolean"
      },
      "DEFAULT_TASK": {
         "default": "task",
         "description": "The name of the default task type to use.",
         "title": "Default Task",
         "type": "string"
      },
      "VASP_KEEP_DOS": {
         "default": false,
         "description": "Whether or not to store the complete DOS from VASP calculations",
         "title": "Vasp Keep Dos",
         "type": "boolean"
      }
   },
   "additionalProperties": false
}

Config:
  • case_sensitive: bool = True

  • env_prefix: str = AUTOJOB_

  • env_ignore_empty: bool = True

Fields:
Validators:
field ARCHIVE_FILE: str = 'task.json'

the default filename to use to archive harvested tasks

Validated by:
field CALCULATION_SCRIPT_TEMPLATE: str = 'run.py.j2'

the name of the default task script template to use

Validated by:
field DEFAULT_CALCULATION_SCRIPT_FILE: str = 'run.py'

the default filename to use for the calculation script

Validated by:
field DEFAULT_TASK: str = 'task'

The name of the default task type to use.

Validated by:
field DEFAULT_TASK_SCRIPT_FILE: str = 'run.sh'

the default filename to use for the task script

Validated by:
field INPUTS_FILE: str = 'inputs.json'

the default filename to use for the input parameters file

Validated by:
field INPUT_ATOMS_FILE: str = 'in.traj'

the default filename to use for the input Atoms file

Validated by:
field LEGACY_MODE: bool = True

Sets the format study group, study, task group, and task IDs. If True, said IDs will be 10-character alphanumerics prefixed by single letters (g, s, c, j, respectively). IDs will be UUID4s otherwise.

Validated by:
field LOG_FILE: Path | None = None

The filename for the log file. Note that this variable is mainly for storing state for application-like use. If you are using autojob as a library, you may be better served configuring handlers.

Validated by:
field LOG_LEVEL: int = 10

The default log level.

Validated by:
field OUTPUT_ATOMS_FILE: str = 'final.traj'

the default filename to use for the output Atoms file

Validated by:
field PARAMETRIZATION_FILE: str = 'parametrizations.json'

the default filename to use to store study parametrization data

Validated by:
field RECORD_FILE: str = 'record.txt'

the default filename to use to store the study record

Validated by:
field SCHEDULER: str = 'slurm'

the name of the scheduler to use

Validated by:
field SCHEDULER_STATS_FILE: str = 'job_stats.json'

the default filename to use for the job stats file

Validated by:
field SLURM_SCRIPT: str = 'vasp.sh'

the default filename to use for the SLURM script

Validated by:
field STRICT_MODE: bool = True

Sets the default behaviour of data retrieval functions and methods. If True, such functions will raise errors when they fail. Otherwise, failure will pass with a log message only. This may be useful if you are harvesting the results of incomplete tasks.

Validated by:
field STUDY_GROUP_METADATA_FILE: str = 'study_group.json'

the default filename to use to store study group metadata

Validated by:
field STUDY_METADATA_FILE: str = 'study.json'

the default filename to use to store study metadata

Validated by:
field TASK_GROUP_METADATA_FILE: str = 'calculation.json'

the default filename to use to store task group metadata

Validated by:
field TASK_METADATA_FILE: str = 'job.json'

the default filename to use to store task metadata

Validated by:
field TASK_SCRIPT: str = 'run.py'

the default filename to use for the python script

Validated by:
field TASK_SCRIPT_TEMPLATE: str = 'run.sh.j2'

the name of the default scheduler script template to use

Validated by:
field TEMPLATE_DIR: Path | None = None

If not None, specifies the directory to use to load templates

Validated by:
field VASP_KEEP_DOS: bool = False

Whether or not to store the complete DOS from VASP calculations

Validated by:
field WORKFLOW_FILE: str = 'workflow.json'

the default filename to use to store study workflow data

Validated by:
validator validate_log_level  »  LOG_LEVEL[source]

Validate the global log level.

validator configure_logging  »  all fields[source]

Configure logging based on user settings.

autojob.study module

Create studies.

pydantic model autojob.study.Study[source]

Bases: BaseModel

A collection of tasks.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Show JSON schema
{
   "title": "Study",
   "description": "A collection of tasks.",
   "type": "object",
   "properties": {
      "tasks": {
         "default": [],
         "description": "A list of tasks in the study",
         "items": {
            "$ref": "#/$defs/TaskBase"
         },
         "title": "Tasks",
         "type": "array"
      },
      "date_created": {
         "description": "The date and time that the study was created",
         "format": "date-time",
         "title": "Date Created",
         "type": "string"
      },
      "study_id": {
         "anyOf": [
            {
               "format": "uuid4",
               "type": "string"
            },
            {
               "type": "string"
            }
         ],
         "title": "Study Id"
      },
      "study_group_id": {
         "anyOf": [
            {
               "format": "uuid4",
               "type": "string"
            },
            {
               "type": "string"
            }
         ],
         "title": "Study Group Id"
      },
      "name": {
         "default": "",
         "description": "The name of the study",
         "title": "Name",
         "type": "string"
      },
      "notes": {
         "default": [],
         "description": "A list of notes about the study",
         "items": {
            "type": "string"
         },
         "title": "Notes",
         "type": "array"
      }
   },
   "$defs": {
      "TaskBase": {
         "additionalProperties": true,
         "description": "An abstract base class for tasks.\n\nNote that by definition, concrete implementations of the class adhere to\nthe :class:`PathLoadable` and :class:`InputWriter` protocols.\n\nConcrete implementations of this class must be defined such that they\ncan be instantiated without arguments.",
         "properties": {
            "task_metadata": {
               "$ref": "#/$defs/TaskMetadataBase",
               "description": "Task metadata"
            },
            "task_inputs": {
               "$ref": "#/$defs/TaskInputsBase",
               "description": "Task inputs"
            },
            "task_outputs": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/TaskOutputsBase"
                  },
                  {
                     "type": "null"
                  }
               ],
               "description": "Task outputs"
            }
         },
         "required": [
            "task_metadata",
            "task_inputs",
            "task_outputs"
         ],
         "title": "TaskBase",
         "type": "object"
      },
      "TaskInputsBase": {
         "additionalProperties": true,
         "description": "The set of task-level inputs.\n\nNote that :class:`TaskInputsBase` instances are ``PathLoadable``.",
         "properties": {
            "atoms": {
               "anyOf": [
                  {
                     "type": "object"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Input or output ase.Atoms",
               "title": "Atoms"
            },
            "files_to_copy": {
               "default": [],
               "description": "The files to copy from the preceding task into the scratch directory of this task.",
               "items": {
                  "type": "string"
               },
               "title": "Files To Copy",
               "type": "array"
            },
            "files_to_delete": {
               "default": [],
               "description": "The files to delete from the directory of the task after job completion.",
               "items": {
                  "type": "string"
               },
               "title": "Files To Delete",
               "type": "array"
            },
            "files_to_carry_over": {
               "default": [],
               "description": "The files to carry over from the completed task to the new job.",
               "items": {
                  "type": "string"
               },
               "title": "Files To Carry Over",
               "type": "array"
            },
            "auto_restart": {
               "default": true,
               "description": "Whether or not to automatically restart this calculation with the same parameters if the task finishes unsuccessfully.",
               "title": "Auto Restart",
               "type": "boolean"
            },
            "atoms_filename": {
               "default": "in.traj",
               "description": "The filename of the input atoms",
               "title": "Atoms Filename",
               "type": "string"
            },
            "task_script": {
               "default": "run.sh",
               "description": "The default filename for the task script",
               "title": "Task Script",
               "type": "string"
            },
            "task_script_template": {
               "default": "run.sh.j2",
               "description": "The name of the default task script template",
               "title": "Task Script Template",
               "type": "string"
            }
         },
         "title": "TaskInputsBase",
         "type": "object"
      },
      "TaskMetadataBase": {
         "additionalProperties": true,
         "description": "The metadata for a task.\n\nNote that :class:`TaskMetadataBase` instances are ``PathLoadable``.",
         "properties": {
            "label": {
               "default": "",
               "description": "A description of the job",
               "title": "Label",
               "type": "string"
            },
            "tags": {
               "default": [],
               "description": "Metadata tagged to a given job",
               "items": {
                  "type": "string"
               },
               "title": "tag",
               "type": "array"
            },
            "uri": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The uri for the directory containing this task",
               "title": "Uri"
            },
            "study_group_id": {
               "anyOf": [
                  {
                     "format": "uuid4",
                     "type": "string"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "description": "The study group uuid",
               "title": "Study Group Id"
            },
            "study_id": {
               "anyOf": [
                  {
                     "format": "uuid4",
                     "type": "string"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "description": "The study uuid",
               "title": "Study Id"
            },
            "workflow_step_id": {
               "anyOf": [
                  {
                     "format": "uuid4",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The workflow step uuid",
               "title": "Workflow Step Id"
            },
            "task_id": {
               "anyOf": [
                  {
                     "format": "uuid4",
                     "type": "string"
                  },
                  {
                     "type": "string"
                  }
               ],
               "description": "A UUID identifying the task.",
               "title": "Task Id"
            },
            "task_group_id": {
               "anyOf": [
                  {
                     "format": "uuid4",
                     "type": "string"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "description": "A UUID identifying a group of tasks.",
               "title": "Task Group Id"
            },
            "date_created": {
               "description": "The date and time that the task was first created.",
               "format": "date-time",
               "title": "Date Created",
               "type": "string"
            },
            "last_updated": {
               "description": "Timestamp for the most recent calculation for this task document",
               "format": "date-time",
               "title": "Last Updated",
               "type": "string"
            },
            "task_class": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The plugin name of the concrete TaskBase implementation to which this metadata belongs (e.g., task)",
               "title": "Task Class"
            }
         },
         "title": "TaskMetadataBase",
         "type": "object"
      },
      "TaskOutcome": {
         "description": "The outcome of a task.\n\nThe meanings of each outcome are as follows:\n\nSUCCESS: The task completed successfully.\nFAILED: The task completed with errors.\nIDLE: The task is yet to run.\nRUNNING: The task is running.\nUNKNOWN: The outcome of the task is unknown.",
         "enum": [
            "success",
            "failed",
            "idle",
            "running",
            "unknown"
         ],
         "title": "TaskOutcome",
         "type": "string"
      },
      "TaskOutputsBase": {
         "description": "The set of task-level outputs.\n\nNote that :class:`TaskOutputsBase` instances are ``PathLoadable``.",
         "properties": {
            "atoms": {
               "anyOf": [
                  {
                     "type": "object"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Input or output ase.Atoms",
               "title": "Atoms"
            },
            "entry": {
               "anyOf": [
                  {
                     "properties": {
                        "@class": {
                           "enum": [
                              "ComputedEntry"
                           ],
                           "type": "string"
                        },
                        "@module": {
                           "enum": [
                              "pymatgen.entries.computed_entries"
                           ],
                           "type": "string"
                        },
                        "@version": {
                           "type": "string"
                        }
                     },
                     "required": [
                        "@class",
                        "@module"
                     ],
                     "type": "object"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The ComputedEntry from the task",
               "title": "Entry"
            },
            "outcome": {
               "$ref": "#/$defs/TaskOutcome",
               "default": "unknown",
               "description": "The outcome of the task"
            }
         },
         "title": "TaskOutputsBase",
         "type": "object"
      }
   }
}

Config:
  • populate_by_name: bool = True

Fields:
field date_created: datetime [Optional]

The date and time that the study was created

field name: str = ''

The name of the study

field notes: list[str] = []

A list of notes about the study

field study_group_id: UUID4 | str [Optional]
Constraints:
  • union_mode = left_to_right

field study_id: UUID4 | str [Optional]
Constraints:
  • union_mode = left_to_right

field tasks: list[TaskBase] = []

A list of tasks in the study

classmethod from_directory(dir_name: Path, *, strict_mode: bool | None = None) Study[source]

Recreate a study from a directory.

Parameters:
  • dir_name – The directory of a completed Task.

  • strict_mode – Whether or not to require all outputs. If True, errors will be thrown on missing outputs. Defaults to SETTINGS.STRICT_MODE.

Returns:

The Study contained in dir_name.

serialize_date_created(v: datetime) str[source]

Serialize the study creation date.

serialize_tasks(v: Any, _: SerializerFunctionWrapHandler, info: FieldSerializationInfo) list[Task] | list[str][source]

Serialize the tasks in the study.

to_directory(dest: Path) None[source]

Dump a study and its tasks to a directory.

Parameters:

dest – The directory in which to dump the Study.

autojob.study_group module

Create study groups.

pydantic model autojob.study_group.StudyGroup[source]

Bases: BaseModel

A collection of studies.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Show JSON schema
{
   "title": "StudyGroup",
   "description": "A collection of studies.",
   "type": "object",
   "properties": {
      "date_created": {
         "description": "The date and time that the study group was created",
         "format": "date-time",
         "title": "Date Created",
         "type": "string"
      },
      "study_group_id": {
         "anyOf": [
            {
               "format": "uuid4",
               "type": "string"
            },
            {
               "type": "string"
            }
         ],
         "description": "A unique identifier for the study group",
         "title": "Study Group Id"
      },
      "studies": {
         "default": [],
         "description": "The studies in the study group",
         "items": {
            "$ref": "#/$defs/Study"
         },
         "title": "Studies",
         "type": "array"
      },
      "name": {
         "default": "",
         "description": "The name of the study group",
         "title": "Name",
         "type": "string"
      },
      "notes": {
         "default": [],
         "description": "A list of notes about the study group",
         "items": {
            "type": "string"
         },
         "title": "Notes",
         "type": "array"
      }
   },
   "$defs": {
      "Study": {
         "description": "A collection of tasks.",
         "properties": {
            "tasks": {
               "default": [],
               "description": "A list of tasks in the study",
               "items": {
                  "$ref": "#/$defs/TaskBase"
               },
               "title": "Tasks",
               "type": "array"
            },
            "date_created": {
               "description": "The date and time that the study was created",
               "format": "date-time",
               "title": "Date Created",
               "type": "string"
            },
            "study_id": {
               "anyOf": [
                  {
                     "format": "uuid4",
                     "type": "string"
                  },
                  {
                     "type": "string"
                  }
               ],
               "title": "Study Id"
            },
            "study_group_id": {
               "anyOf": [
                  {
                     "format": "uuid4",
                     "type": "string"
                  },
                  {
                     "type": "string"
                  }
               ],
               "title": "Study Group Id"
            },
            "name": {
               "default": "",
               "description": "The name of the study",
               "title": "Name",
               "type": "string"
            },
            "notes": {
               "default": [],
               "description": "A list of notes about the study",
               "items": {
                  "type": "string"
               },
               "title": "Notes",
               "type": "array"
            }
         },
         "title": "Study",
         "type": "object"
      },
      "TaskBase": {
         "additionalProperties": true,
         "description": "An abstract base class for tasks.\n\nNote that by definition, concrete implementations of the class adhere to\nthe :class:`PathLoadable` and :class:`InputWriter` protocols.\n\nConcrete implementations of this class must be defined such that they\ncan be instantiated without arguments.",
         "properties": {
            "task_metadata": {
               "$ref": "#/$defs/TaskMetadataBase",
               "description": "Task metadata"
            },
            "task_inputs": {
               "$ref": "#/$defs/TaskInputsBase",
               "description": "Task inputs"
            },
            "task_outputs": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/TaskOutputsBase"
                  },
                  {
                     "type": "null"
                  }
               ],
               "description": "Task outputs"
            }
         },
         "required": [
            "task_metadata",
            "task_inputs",
            "task_outputs"
         ],
         "title": "TaskBase",
         "type": "object"
      },
      "TaskInputsBase": {
         "additionalProperties": true,
         "description": "The set of task-level inputs.\n\nNote that :class:`TaskInputsBase` instances are ``PathLoadable``.",
         "properties": {
            "atoms": {
               "anyOf": [
                  {
                     "type": "object"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Input or output ase.Atoms",
               "title": "Atoms"
            },
            "files_to_copy": {
               "default": [],
               "description": "The files to copy from the preceding task into the scratch directory of this task.",
               "items": {
                  "type": "string"
               },
               "title": "Files To Copy",
               "type": "array"
            },
            "files_to_delete": {
               "default": [],
               "description": "The files to delete from the directory of the task after job completion.",
               "items": {
                  "type": "string"
               },
               "title": "Files To Delete",
               "type": "array"
            },
            "files_to_carry_over": {
               "default": [],
               "description": "The files to carry over from the completed task to the new job.",
               "items": {
                  "type": "string"
               },
               "title": "Files To Carry Over",
               "type": "array"
            },
            "auto_restart": {
               "default": true,
               "description": "Whether or not to automatically restart this calculation with the same parameters if the task finishes unsuccessfully.",
               "title": "Auto Restart",
               "type": "boolean"
            },
            "atoms_filename": {
               "default": "in.traj",
               "description": "The filename of the input atoms",
               "title": "Atoms Filename",
               "type": "string"
            },
            "task_script": {
               "default": "run.sh",
               "description": "The default filename for the task script",
               "title": "Task Script",
               "type": "string"
            },
            "task_script_template": {
               "default": "run.sh.j2",
               "description": "The name of the default task script template",
               "title": "Task Script Template",
               "type": "string"
            }
         },
         "title": "TaskInputsBase",
         "type": "object"
      },
      "TaskMetadataBase": {
         "additionalProperties": true,
         "description": "The metadata for a task.\n\nNote that :class:`TaskMetadataBase` instances are ``PathLoadable``.",
         "properties": {
            "label": {
               "default": "",
               "description": "A description of the job",
               "title": "Label",
               "type": "string"
            },
            "tags": {
               "default": [],
               "description": "Metadata tagged to a given job",
               "items": {
                  "type": "string"
               },
               "title": "tag",
               "type": "array"
            },
            "uri": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The uri for the directory containing this task",
               "title": "Uri"
            },
            "study_group_id": {
               "anyOf": [
                  {
                     "format": "uuid4",
                     "type": "string"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "description": "The study group uuid",
               "title": "Study Group Id"
            },
            "study_id": {
               "anyOf": [
                  {
                     "format": "uuid4",
                     "type": "string"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "description": "The study uuid",
               "title": "Study Id"
            },
            "workflow_step_id": {
               "anyOf": [
                  {
                     "format": "uuid4",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The workflow step uuid",
               "title": "Workflow Step Id"
            },
            "task_id": {
               "anyOf": [
                  {
                     "format": "uuid4",
                     "type": "string"
                  },
                  {
                     "type": "string"
                  }
               ],
               "description": "A UUID identifying the task.",
               "title": "Task Id"
            },
            "task_group_id": {
               "anyOf": [
                  {
                     "format": "uuid4",
                     "type": "string"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "description": "A UUID identifying a group of tasks.",
               "title": "Task Group Id"
            },
            "date_created": {
               "description": "The date and time that the task was first created.",
               "format": "date-time",
               "title": "Date Created",
               "type": "string"
            },
            "last_updated": {
               "description": "Timestamp for the most recent calculation for this task document",
               "format": "date-time",
               "title": "Last Updated",
               "type": "string"
            },
            "task_class": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The plugin name of the concrete TaskBase implementation to which this metadata belongs (e.g., task)",
               "title": "Task Class"
            }
         },
         "title": "TaskMetadataBase",
         "type": "object"
      },
      "TaskOutcome": {
         "description": "The outcome of a task.\n\nThe meanings of each outcome are as follows:\n\nSUCCESS: The task completed successfully.\nFAILED: The task completed with errors.\nIDLE: The task is yet to run.\nRUNNING: The task is running.\nUNKNOWN: The outcome of the task is unknown.",
         "enum": [
            "success",
            "failed",
            "idle",
            "running",
            "unknown"
         ],
         "title": "TaskOutcome",
         "type": "string"
      },
      "TaskOutputsBase": {
         "description": "The set of task-level outputs.\n\nNote that :class:`TaskOutputsBase` instances are ``PathLoadable``.",
         "properties": {
            "atoms": {
               "anyOf": [
                  {
                     "type": "object"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Input or output ase.Atoms",
               "title": "Atoms"
            },
            "entry": {
               "anyOf": [
                  {
                     "properties": {
                        "@class": {
                           "enum": [
                              "ComputedEntry"
                           ],
                           "type": "string"
                        },
                        "@module": {
                           "enum": [
                              "pymatgen.entries.computed_entries"
                           ],
                           "type": "string"
                        },
                        "@version": {
                           "type": "string"
                        }
                     },
                     "required": [
                        "@class",
                        "@module"
                     ],
                     "type": "object"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The ComputedEntry from the task",
               "title": "Entry"
            },
            "outcome": {
               "$ref": "#/$defs/TaskOutcome",
               "default": "unknown",
               "description": "The outcome of the task"
            }
         },
         "title": "TaskOutputsBase",
         "type": "object"
      }
   }
}

Config:
  • populate_by_name: bool = True

Fields:
field date_created: datetime [Optional]

The date and time that the study group was created

field name: str = ''

The name of the study group

field notes: list[str] = []

A list of notes about the study group

field studies: list[Study] = []

The studies in the study group

field study_group_id: Annotated[UUID, UuidVersion(uuid_version=4)] | str [Optional]

A unique identifier for the study group

Constraints:
  • union_mode = left_to_right

classmethod from_directory(dir_name: Path, *, strict_mode: bool | None = None) Self[source]

Create a study group from a directory.

Parameters:
  • dir_name – The directory of a study group.

  • strict_mode – Whether or not to require all outputs. If True, errors will be thrown on missing outputs. Defaults to SETTINGS.STRICT_MODE.

serialize_studies(v: Any, _: SerializerFunctionWrapHandler, info: FieldSerializationInfo) list[Study] | list[str][source]

Serialize the studies in the study group.

to_directory(src: Path) None[source]

Create a directory for a study group.

Parameters:

src – The directory in which to dump the StudyGroup.

autojob.workflow module

Create workflows from multiple step.

pydantic model autojob.workflow.Step[source]

Bases: BaseModel

A step in a workflow.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Show JSON schema
{
   "title": "Step",
   "type": "object",
   "properties": {
      "workflow_step_id": {
         "anyOf": [
            {
               "format": "uuid",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "A unique identifier for the workflow step",
         "title": "Workflow Step Id"
      },
      "task_class": {
         "description": "The task class for the workflow step",
         "title": "Task Class",
         "type": "string"
      },
      "progression": {
         "default": "independent",
         "description": "How the step is connected to the tasks of the previous step. 'dependent' indicates that the given step cannot start until every task in the previous step has completed. 'independent' indicates the opposite.",
         "enum": [
            "independent",
            "dependent"
         ],
         "title": "Progression",
         "type": "string"
      },
      "parametrizations": {
         "default": null,
         "title": "Parametrizations"
      }
   }
}

Fields:
field parametrizations: list[list[VariableReference[Any]]] [Required]
Constraints:
  • min_length = 1

field progression: Literal['independent', 'dependent'] = 'independent'

How the step is connected to the tasks of the previous step. ‘dependent’ indicates that the given step cannot start until every task in the previous step has completed. ‘independent’ indicates the opposite.

field task_class: str [Optional]

The task class for the workflow step

field workflow_step_id: UUID | None = None

A unique identifier for the workflow step

class autojob.workflow.Workflow(graph: dict[str, Iterable[str]])[source]

Bases: TopologicalSorter

The structure of a workflow.

Initialize a Workflow.

Parameters:

graph – A directed-acyclic graph representing the workflow.

classmethod from_directory(dir_name: Path) Workflow[source]

Construct a Workflow from a directory.

get_next_steps(step_id: str, record: list[str] | None = None) list[str][source]

Get all successors of a step.

Parameters:
  • step_id – A string representation of a workflow step ID

  • record – A list of strings where each string represents the workflow step ID of a completed task. If None, all successive steps will be returned. Defaults to None.

Returns:

A list of strings where each string represents a workflow step ID.

get_predecessors(step_id: str) list[str][source]

Return the immediate ancestors of a workflow step.

Parameters:

step_id – A string representation of a workflow step ID.