How to Configure autojob¶
This page describes how to configure autojob using environment variables,
a configuration file, and in Python code using the global instance of
AutojobSettings. The aforementioned methods can be combined to define
settings. Settings defined by environment variables overwrite those defined
in configuration files. For a list and description of all settings (and their
default values), see the AutojobSettings class.
Configuring autojob with a Configuration File¶
Any autojob setting can be set using a TOML configuration file. The name
of the setting in the TOML must be the same as the AutojobSettings
attribute.
# ~/.config/autojob/config.toml
[tool.autojob]
# Change the default file name for the trajectories of input Atoms objects
INPUT_ATOMS_FILE = "atoms.traj"
# Set the directory from which script templates are retrieved
TEMPLATE_DIR = "my_templates"
# Store the complete DOS objects from VASP calculations
VASP_KEEP_DOS = true
If the environment variable AUTOJOB_CONFIG_FILE is defined, autojob will
define settings according to the contents of the file. Otherwise, autojob
will try to read a configuration from ~/.config/autojob/config.toml.
Configuring autojob using Environment Variables¶
Any autojob setting can be set using environment variables. The name
of the environment variable must be the name as the AutojobSettings
attribute prefixed with AUTOJOB_.
#!/usr/bin/env bash
...
# Change the default file name for the trajectories of input Atoms objects
export AUTOJOB_INPUT_ATOMS_FILE=atoms.traj
# Set the directory from which script templates are retrieved
export AUTOJOB_TEMPLATE_DIR=my_templates
# Store the complete DOS objects from VASP calculations
export AUTOJOB_VASP_KEEP_DOS=true
# call autojob
autojob run "python run.py"
autojob harvest
autojob restart
...
Configuring autojob with SETTINGS¶
The module-level variable, SETTINGS, can be used to modify autojob
settings at runtime.
from pathlib import Path
from autojob import SETTINGS
# Change the default file name for the trajectories of input Atoms objects
SETTINGS.INPUT_ATOMS_FILE = "atoms.traj"
# Set the directory from which script templates are retrieved
SETTINGS.TEMPLATE_DIR = Path("my_templates")
# Store the complete DOS objects from VASP calculations
SETTINGS.VASP_KEEP_DOS = True