autojob package¶
Tools for DFT job automation on massively parallel computing resources.
Subpackages¶
- autojob.bases package
- Submodules
- autojob.bases.analysis_base module
- autojob.bases.harvester_base module
- autojob.bases.task_base module
InputWriterPathLoadableSetTaskClassMixinTaskBaseTaskInputsBaseTaskMetadataBaseTaskMetadataBase.date_createdTaskMetadataBase.from_directory()TaskMetadataBase.labelTaskMetadataBase.last_updatedTaskMetadataBase.model_configTaskMetadataBase.study_group_idTaskMetadataBase.study_idTaskMetadataBase.tagsTaskMetadataBase.task_classTaskMetadataBase.task_group_idTaskMetadataBase.task_idTaskMetadataBase.uriTaskMetadataBase.workflow_step_id
TaskOutcomeTaskOutputsBase
- autojob.coordinator package
- Subpackages
- autojob.coordinator.gui package
- Submodules
- autojob.coordinator.gui.groups module
- autojob.coordinator.gui.gui module
- autojob.coordinator.gui.job_submission module
- autojob.coordinator.gui.parameter_selection module
- autojob.coordinator.gui.structure_selection module
- autojob.coordinator.gui.study_configuration module
- autojob.coordinator.gui.submission_configuration module
- autojob.coordinator.gui.summary module
- autojob.coordinator.gui.widgets module
- autojob.coordinator.gui package
- Submodules
- autojob.coordinator.classification module
ABCEnumMetaCalculationTypeCalculatorTypeCalculatorType.ABINITCalculatorType.AIMSCalculatorType.AMBERCalculatorType.ASAPCalculatorType.CASTEPCalculatorType.CP2KCalculatorType.CRYSTALCalculatorType.DEMONCalculatorType.DEMON_NANOCalculatorType.DFTBCalculatorType.DFTD3CalculatorType.DMOL3CalculatorType.EAMCalculatorType.ELKCalculatorType.EMTCalculatorType.ESPRESSOCalculatorType.EXCITINGCalculatorType.FLEURCalculatorType.FORCE_FIELDCalculatorType.GAMESS_USCalculatorType.GAUSSIANCalculatorType.GPAWCalculatorType.GROMACSCalculatorType.GULPCalculatorType.HOTBITCalculatorType.KIMCalculatorType.LAMMPSCalculatorType.LAMMPS_LIBCalculatorType.LENNARD_JONESCalculatorType.MOPACCalculatorType.MORSE_POTENTIALCalculatorType.NWCHEMCalculatorType.OCTOPUSCalculatorType.ONETEPCalculatorType.OPENMXCalculatorType.ORCACalculatorType.PSI4CalculatorType.QCHEMCalculatorType.SIESTACalculatorType.TIP3PCalculatorType.TIP4PCalculatorType.TURBOMOLECalculatorType.VASPCalculatorType.is_default()CalculatorType.is_implemented()
ImplementableEnumStudyType
- autojob.coordinator.coordinator module
CoordinatorCoordinator.adsorbatesCoordinator.adsorption_groupsCoordinator.adsorption_jobsCoordinator.calc_param_from()Coordinator.calc_param_values_for()Coordinator.calc_paramsCoordinator.calc_params_for()Coordinator.calculation_typeCoordinator.calculatorCoordinator.calculator_typeCoordinator.complexesCoordinator.create_structure_tasks()Coordinator.create_study_group()Coordinator.create_tasks()Coordinator.jobsCoordinator.run_jobs()Coordinator.sensitivity_jobsCoordinator.structure_groupsCoordinator.structure_groups_with()Coordinator.structuresCoordinator.structures_without_calc_paramsCoordinator.structures_without_subm_paramsCoordinator.studiesCoordinator.study_typeCoordinator.subm_paramsCoordinator.subm_params_for()Coordinator.submission_parameter_groups
submission_parameters_to_scheduler_inputs()
- autojob.coordinator.espresso module
- autojob.coordinator.filters module
- autojob.coordinator.gaussian module
- autojob.coordinator.job module
- autojob.coordinator.parameters module
CalculatorParameterCalculatorTypeCalculatorType.ABINITCalculatorType.ACECalculatorType.AIMSCalculatorType.AMBERCalculatorType.ASAPCalculatorType.CASTEPCalculatorType.CP2KCalculatorType.CRYSTALCalculatorType.DEFAULTCalculatorType.DEMONCalculatorType.DEMON_NANOCalculatorType.DFTBCalculatorType.DFTD3CalculatorType.DMOL3CalculatorType.EAMCalculatorType.ELKCalculatorType.EMTCalculatorType.ESPRESSOCalculatorType.EXCITINGCalculatorType.FLEURCalculatorType.FORCE_FIELDCalculatorType.GAMESS_USCalculatorType.GAUSSIANCalculatorType.GPAWCalculatorType.GROMACSCalculatorType.GULPCalculatorType.HOTBITCalculatorType.KIMCalculatorType.LAMMPSCalculatorType.LAMMPS_LIBCalculatorType.LENNARD_JONESCalculatorType.MOPACCalculatorType.MORSE_POTENTIALCalculatorType.NWCHEMCalculatorType.OCTOPUSCalculatorType.ONETEPCalculatorType.OPENMXCalculatorType.ORCACalculatorType.PSI4CalculatorType.QCHEMCalculatorType.SIESTACalculatorType.TIP3PCalculatorType.TIP4PCalculatorType.TURBOMOLECalculatorType.VASPCalculatorType.is_implemented()
MappingParameterNumberMappingParameterNumberParameterNumberRangeNumberSequenceParameterSequenceParameter
- autojob.coordinator.validation module
- autojob.coordinator.vasp module
- Subpackages
- autojob.harvest package
- autojob.next package
- autojob.tasks namespace
- Submodules
- autojob.tasks.calculation module
CalculationCalculation.calculation_inputsCalculation.calculation_outputsCalculation.from_directory()Calculation.model_configCalculation.patch_task()Calculation.prepare_input_atoms()Calculation.write_calculation_script()Calculation.write_input_atoms()Calculation.write_inputs()Calculation.write_inputs_json()Calculation.write_task_script()
CalculationInputsCalculationOutputsCalculationOutputs.analysis_resultsCalculationOutputs.calculator_resultsCalculationOutputs.convergedCalculationOutputs.energyCalculationOutputs.forcesCalculationOutputs.from_directory()CalculationOutputs.model_configCalculationOutputs.optimizer_resultsCalculationOutputs.serialize_calculator_results()
- autojob.tasks.md module
- autojob.tasks.mh module
MHInitParamsMHInitParams.Ediff0MHInitParams.T0MHInitParams.alpha1MHInitParams.alpha2MHInitParams.beta1MHInitParams.beta2MHInitParams.beta3MHInitParams.fmaxMHInitParams.logfileMHInitParams.mdminMHInitParams.minima_thresholdMHInitParams.minima_trajMHInitParams.optimizerMHInitParams.rngMHInitParams.timestep
MHInputsMHOutputsMHRunParamsMinimaHopping
- autojob.tasks.scan module
- autojob.tasks.task module
TaskTaskInputsTaskMetadataTaskMetadata.date_createdTaskMetadata.from_directory()TaskMetadata.labelTaskMetadata.last_updatedTaskMetadata.model_configTaskMetadata.study_group_idTaskMetadata.study_idTaskMetadata.tagsTaskMetadata.task_classTaskMetadata.task_group_idTaskMetadata.task_idTaskMetadata.uriTaskMetadata.validate_ids()TaskMetadata.workflow_step_id
TaskOutputs
- autojob.tasks.vibration module
- autojob.utils package
alphanum_key()alphanum_sort()get_slurm_job_id()get_uri()iter_to_native()parse_job_stats_file()val_to_native()- Submodules
- autojob.utils.atoms module
- autojob.utils.cli module
- autojob.utils.files module
check_job_status()copy_permissions_and_ownership()create_job_stats_file()create_templated_dir_name()find_finished_jobs()find_last_submitted_jobs()find_study_dirs()find_study_group_dirs()find_task_dirs()find_task_group_dirs()get_last_updated()get_loader()get_slurm_job_id()get_uri()template_script()
- autojob.utils.optimize module
- autojob.utils.parsing module
- autojob.utils.schemas module
- autojob.utils.templates module
- autojob.utils.vasp module
Submodules¶
autojob.hpc module¶
Interface with high performance computing resources.
- class autojob.hpc.JobState(value)[source]¶
Bases:
StrEnumThe 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:
EnumA 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.
- class autojob.hpc.ScheduledMixin[source]¶
Bases:
objectA mixin class for scheduled tasks.
- scheduler_inputs: SchedulerInputs = FieldInfo(annotation=NoneType, required=False, default_factory=SchedulerInputs, description='The scheduler intputs')¶
- scheduler_outputs: SchedulerOutputs | None = FieldInfo(annotation=NoneType, required=False, default=None, description='The scheduler statistics and outputs')¶
- class autojob.hpc.SchedulerInputs(*, job_name: str | None = None, account: str | None = None, partition: list[Partition] | None = None, mem: Annotated[int, WrapValidator(func=validate_memory, json_schema_input_type=PydanticUndefined), WrapSerializer(func=serialize_memory, return_type=PydanticUndefined, when_used=json)] | None = None, mem_per_cpu: Annotated[int, WrapValidator(func=validate_memory, json_schema_input_type=PydanticUndefined), WrapSerializer(func=serialize_memory, return_type=PydanticUndefined, when_used=json)] | None = None, nodes: int | None = None, ntasks_per_node: int | None = None, cpus_per_task: int | None = None, time: Annotated[timedelta, WrapValidator(func=validate_time, json_schema_input_type=PydanticUndefined), WrapSerializer(func=serialize_time, return_type=PydanticUndefined, when_used=json)] | None = None, mail_user: str | None = None, mail_type: list[str] | None = None)[source]¶
Bases:
BaseModelThe 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.
- 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.
- 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.
- model_config = {'alias_generator': <function hyphenate>, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- serialize_mail_type(v: Any, _: SerializerFunctionWrapHandler, info: FieldSerializationInfo) list[str] | str | None[source]¶
Serialize the
mail_typeoption value.
- serialize_partitions(v: list[Partition], _: SerializerFunctionWrapHandler, info: FieldSerializationInfo) list[Partition] | str | None[source]¶
Serialize the partitions in the scheduler request.
- 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.
- class autojob.hpc.SchedulerOutputs(*, elapsed: Annotated[timedelta, WrapValidator(func=validate_time, json_schema_input_type=PydanticUndefined), WrapSerializer(func=serialize_time, return_type=PydanticUndefined, when_used=json)] | None = None, idle_time: Annotated[timedelta, WrapValidator(func=validate_time, json_schema_input_type=PydanticUndefined), WrapSerializer(func=serialize_time, return_type=PydanticUndefined, when_used=json)] | None = None, job_id: int | None = None, max_rss: Annotated[int, WrapValidator(func=validate_memory, json_schema_input_type=PydanticUndefined), WrapSerializer(func=serialize_memory, return_type=PydanticUndefined, when_used=json)] | None = None, nodes: list[str] = [], partition: str | None = None, state: JobState = JobState.UNKNOWN, **extra_data: Any)[source]¶
Bases:
BaseModelThe 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.
- 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.
- model_config: ClassVar[ConfigDict] = {'extra': 'allow'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod validate_job_state(v: Any, handler: ValidatorFunctionWrapHandler, _: ValidationInfo) JobState[source]¶
Validate the job state from the value or name of a JobState.
- 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:
RuntimeError – Unable to determine shell.
ValueError – The scheduler is not supported.
- 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.legacy module¶
Legacy classes.
Deprecated since version v.0.12.0b2.
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
AttributePathandAttributePathsand 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
AttributePathindicating the variable to set.get_path – An
AttributePathindicating the source variable. Defaults to None.get_paths – A list of
AttributePaths, 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:
NotImplementedError –
get_pathsandcomposerVariableReference` s are not supported –
- 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
shellin 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.Calculationrepresenting 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
VariableReferences 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.
Note
When setting the input parameters for the restart task, this function will assume that any top-level task attribute suffixed with _inputs is an input. For example, when restarting a
Calculation, attr:.Calculation.task_inputs, attr:.Calculation.calculation_inputs, and attr:.Calculation.scheduler_inputs will be carried over. When restarting aMolecularDynamicstask, attr:.Calculation.md_inputs will be carried over in addition to the three aforementioned inputs.
- 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 registered through entry points.
- autojob.plugins.discover_harvester_plugins() None[source]¶
Discover harvesters registered through entry points.
- autojob.plugins.discover_task_plugins() None[source]¶
Discover tasks registered 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:
ValueError – Unsupported plugin type.
TypeError – plugin is not the correct type.
autojob.settings module¶
Global settings and configuration for autojob.
- class autojob.settings.AutojobSettings(_case_sensitive: bool | None = None, _nested_model_default_partial_update: bool | None = None, _env_prefix: str | None = None, _env_prefix_target: EnvPrefixTarget | None = None, _env_file: DotenvType | None = PosixPath('.'), _env_file_encoding: str | None = None, _env_ignore_empty: bool | None = None, _env_nested_delimiter: str | None = None, _env_nested_max_split: int | None = None, _env_parse_none_str: str | None = None, _env_parse_enums: bool | None = None, _cli_prog_name: str | None = None, _cli_parse_args: bool | list[str] | tuple[str, ...] | None = None, _cli_settings_source: CliSettingsSource[Any] | None = None, _cli_parse_none_str: str | None = None, _cli_hide_none_type: bool | None = None, _cli_avoid_json: bool | None = None, _cli_enforce_required: bool | None = None, _cli_use_class_docs_for_groups: bool | None = None, _cli_exit_on_error: bool | None = None, _cli_prefix: str | None = None, _cli_flag_prefix_char: str | None = None, _cli_implicit_flags: bool | Literal['dual', 'toggle'] | None = None, _cli_ignore_unknown_args: bool | None = None, _cli_kebab_case: bool | Literal['all', 'no_enums'] | None = None, _cli_shortcuts: Mapping[str, str | list[str]] | None = None, _secrets_dir: PathType | None = None, _build_sources: tuple[tuple[PydanticBaseSettingsSource, ...], dict[str, Any]] | None = None, *, INPUT_ATOMS_FILE: str = 'in.traj', INPUTS_FILE: str = 'inputs.json', DEFAULT_TASK_SCRIPT_FILE: str = 'run.sh', DEFAULT_CALCULATION_SCRIPT_FILE: str = 'run.py', OUTPUT_ATOMS_FILE: str = 'final.traj', SCHEDULER_STATS_FILE: str = 'job_stats.json', ARCHIVE_FILE: str = 'archive.json', TASK_METADATA_FILE: str = 'task.json', TASK_GROUP_METADATA_FILE: str = 'task_group.json', STUDY_METADATA_FILE: str = 'study.json', STUDY_GROUP_METADATA_FILE: str = 'study_group.json', RECORD_FILE: str = 'record.txt', WORKFLOW_FILE: str = 'workflow.json', PARAMETRIZATION_FILE: str = 'parametrizations.json', TEMPLATE_DIR: Path | None = None, TASK_SCRIPT_TEMPLATE: str = 'run.sh.j2', CALCULATION_SCRIPT_TEMPLATE: str = 'run.py.j2', SCHEDULER: str = 'slurm', LOG_FILE: Path | None = None, LOG_LEVEL: int = 10, STRICT_MODE: bool = True, LEGACY_MODE: bool = True, DEFAULT_TASK: str = 'task', VASP_KEEP_DOS: bool = False)[source]¶
Bases:
BaseSettingsSettings 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.
- configure_logging() AutojobSettings[source]¶
Configure logging based on user settings.
- model_config: ClassVar[SettingsConfigDict] = {'arbitrary_types_allowed': True, 'case_sensitive': True, 'cli_avoid_json': False, 'cli_enforce_required': False, 'cli_exit_on_error': True, 'cli_flag_prefix_char': '-', 'cli_hide_none_type': False, 'cli_ignore_unknown_args': False, 'cli_implicit_flags': False, 'cli_kebab_case': False, 'cli_parse_args': None, 'cli_parse_none_str': None, 'cli_prefix': '', 'cli_prog_name': None, 'cli_shortcuts': None, 'cli_use_class_docs_for_groups': False, 'enable_decoding': True, 'env_file': None, 'env_file_encoding': None, 'env_ignore_empty': True, 'env_nested_delimiter': None, 'env_nested_max_split': None, 'env_parse_enums': None, 'env_parse_none_str': None, 'env_prefix': 'AUTOJOB_', 'env_prefix_target': 'variable', 'extra': 'forbid', 'json_file': None, 'json_file_encoding': None, 'nested_model_default_partial_update': False, 'protected_namespaces': ('model_validate', 'model_dump', 'settings_customise_sources'), 'pyproject_toml_table_header': ('tool', 'autojob'), 'secrets_dir': None, 'toml_file': None, 'validate_default': True, 'yaml_config_section': None, 'yaml_file': None, 'yaml_file_encoding': None}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod settings_customise_sources(settings_cls: type[BaseSettings], init_settings: PydanticBaseSettingsSource, env_settings: PydanticBaseSettingsSource, dotenv_settings: PydanticBaseSettingsSource, file_secret_settings: PydanticBaseSettingsSource) tuple[PydanticBaseSettingsSource, ...][source]¶
Add a TOML configuration file to the settings sources.
Note that the name of the TOML file can be set via environment variables. Otherwise, the default filename is used.
autojob.study module¶
Create studies.
- class autojob.study.Study(*, tasks: list[TaskBase] = [], date_created: datetime = <factory>, study_id: UUID, ~pydantic.types.UuidVersion(uuid_version=4)] | str, _PydanticGeneralMetadata(union_mode='left_to_right')] = <factory>, study_group_id: UUID, ~pydantic.types.UuidVersion(uuid_version=4)] | str, _PydanticGeneralMetadata(union_mode='left_to_right')] = <factory>, name: str = '', notes: list[str] = [])[source]¶
Bases:
BaseModelA 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.
- date_created: datetime¶
- 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
Studycontained indir_name.
- model_config: ClassVar = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- serialize_tasks(v: Any, _: SerializerFunctionWrapHandler, info: FieldSerializationInfo) list[Task] | list[str][source]¶
Serialize the tasks in the study.
- to_directory(dest: Path, *, study_template: str | None = None, task_group_template: str | None = None, task_template: str | None = None) Path[source]¶
Dump a study and its tasks to a directory.
- Parameters:
dest – The directory in which to dump the
Study.study_template – A template string for naming study directories. Defaults to None in which case the study ID will be used to create the directory.
task_group_template – A template string for naming task group directories. Defaults to None in which case the task group ID will be used to create the directory.
task_template – A template string for naming task directories. Defaults to None in which case the task ID will be used to create the directory.
- Returns:
The study group directory that was created.
autojob.study_group module¶
Create study groups.
- class autojob.study_group.StudyGroup(*, date_created: datetime = <factory>, study_group_id: UUID, ~pydantic.types.UuidVersion(uuid_version=4)] | str, _PydanticGeneralMetadata(union_mode='left_to_right')] = <factory>, studies: list[Study] = [], name: str = '', notes: list[str] = [])[source]¶
Bases:
BaseModelA 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.
- 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.
- model_config: ClassVar = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- serialize_studies(v: Any, _: SerializerFunctionWrapHandler, info: FieldSerializationInfo) list[Study] | list[str][source]¶
Serialize the studies in the study group.
- study_group_id: Annotated[UUID, UuidVersion(uuid_version=4)] | str¶
- to_directory(src: Path, *, study_group_template: str | None = None, study_template: str | None = None, task_group_template: str | None = None, task_template: str | None = None) Path[source]¶
Create a directory for a study group.
- Parameters:
src – The directory in which to dump the
StudyGroup.study_group_template – A template string for naming study group directories. Defaults to None in which case the study group ID will be used to create the directory.
study_template – A template string for naming study directories. Defaults to None in which case the study ID will be used to create the directory.
task_group_template – A template string for naming task group directories. Defaults to None in which case the task group ID will be used to create the directory.
task_template – A template string for naming task directories. Defaults to None in which case the task ID will be used to create the directory.
- Returns:
The study group directory that was created.
autojob.workflow module¶
Create workflows from multiple step.
- class autojob.workflow.Step(*, workflow_step_id: ~uuid.UUID | None = None, task_class: str = <factory>, progression: ~typing.Literal['independent', 'dependent'] = 'independent', parametrizations: ~typing.Annotated[list[list[~autojob.parametrizations.VariableReference[~typing.Any]]], ~annotated_types.MinLen(min_length=1)])[source]¶
Bases:
BaseModelA 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.
- model_config = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- parametrizations: list[list[VariableReference[Any]]]¶
- class autojob.workflow.Workflow(graph: dict[str, Iterable[str]])[source]¶
Bases:
TopologicalSorterThe structure of a workflow.
Initialize a Workflow.
- Parameters:
graph – A directed-acyclic graph representing the workflow.
- 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.