Command Line¶
Pipeline CLI for running multiple qm_atlas commands in sequence.
Allows combining multiple CLI steps into a single pipeline run, configured via a YAML file. Paths for input files and output (results directory) can be provided as CLI arguments instead of being hard-coded in the config.
- Pipeline Behavior:
When a step has
submit: truein itssubmission_config, the pipeline automatically forceswait: trueso that subsequent steps only begin after the submitted jobs have finished.The pipeline itself can be submitted to the cluster using the top-level
submission_config.submit: trueoption. In that case, the resolved config is dumped to a YAML file and the pipeline is re-invoked on the cluster withqm-atlas pipeline --config <resolved_config>.yaml.
Example YAML config:
steps:
- command: read_input
- command: fast_conformers
submission_config:
submit: true
- command: add_reference_conformers
- command: optimize_reference_conformers
submission_config:
submit: true
- command: conformer_properties
submission_config:
submit: true
conformer_property_options:
calculation_tasks:
- backend: "turbomole_single_point"
- command: cosmotherm_properties
submission_config:
submit: true
Usage:
qm-atlas pipeline --config pipeline.yaml \
--input_file ./molecules.sdf \
--results_directory ./results
# With separate reference conformer input files:
qm-atlas pipeline --config pipeline.yaml \
--input_file ./molecules.sdf \
--reference_input_file ./ref_conformers.sdf \
--results_directory ./results
# Submit the pipeline itself to the cluster:
qm-atlas pipeline --config pipeline.yaml \
--input_file ./molecules.sdf \
--results_directory ./results \
--submission_config.submit true
- class qm_atlas.command_line.pipeline.PipelineSubmissionConfig(**data)[source]¶
UGE submission settings specific to the Pipeline CLI.
- Parameters:
- class qm_atlas.command_line.pipeline.PipelineConfig(**data)[source]¶
Complete configuration for a pipeline run.
- Parameters:
- submission_config: SubmissionConfig¶
- classmethod validate_results_directory_field(v)[source]¶
Validate results directory using arg_utils validation.
For read_input, the results directory is created if it doesn’t exist. Pydantic handles conversion to Path.
- resolve_steps()[source]¶
Inject paths, force wait, and deserialize steps to typed config objects.
This runs after all field validators, so
self.results_directoryetc. are already resolved. For each raw step dict the method:Injects top-level pipeline paths (results_directory, input_file, …)
Forces
wait=trueon steps withsubmit=trueDeserializes the dict into the appropriate config class via
STEP_REGISTRY, following the same pattern used byConformerPropertyOptionsforcalculation_tasks.
- Return type:
- qm_atlas.command_line.pipeline.load_config(argv=None)[source]¶
Load and validate configuration using jsonargparse + Pydantic.
Supports: - YAML config file via –config - Command-line argument overrides for paths and submission settings
- Parameters:
argv (
list[str] |None) – Command-line arguments. If None, uses sys.argv[1:].- Returns:
Validated configuration object with paths resolved.
- Return type:
- Raises:
SystemExit – On parse errors or validation failures.
- qm_atlas.command_line.pipeline.run_pipeline(config)[source]¶
Execute all steps in the pipeline sequentially.
- Parameters:
config (
PipelineConfig) – Validated pipeline configuration with paths and wait flags already resolved.- Return type:
- qm_atlas.command_line.pipeline.submit(config)[source]¶
Submit the pipeline itself to the cluster.
Dumps the fully resolved config to a YAML file, then submits
qm-atlas pipeline --config <resolved_config>.yamlto the cluster.- Return type:
- Parameters:
config (PipelineConfig)
- qm_atlas.command_line.pipeline.main(argv=None, config=None, log_file=None)[source]¶
Main entry point for the pipeline CLI.
Utilities for command-line argument handling and validation.
- class qm_atlas.command_line.base_config.CalculationInput(**data)[source]¶
Configuration for accessing existing results directories or compound directories.
Requirements: - results_directory is always required - Exactly one of compound_directories or task_control_file can be provided (mutually exclusive) - If task_id is provided, task_control_file must also be provided
- Parameters:
- classmethod validate_results_directory_field(v)[source]¶
Validate results directory using arg_utils validation.
For read_input, the results directory is created if it doesn’t exist. Pydantic handles conversion to Path.
- classmethod validate_compound_directories_field(v)[source]¶
Convert compound_directories to list of Paths and validate.
Ensures all paths exist and are directories.
- classmethod validate_task_control_file(input_path)[source]¶
Validate task control file if explicitly provided.
- validate_mutual_exclusivity()[source]¶
Validate that compound_directories and task_control_file are mutually exclusive.
- Return type:
- class qm_atlas.command_line.base_config.SubmissionConfig(**data)[source]¶
Configuration for UGE (Univa Grid Engine) job submission.
This class is designed to be used across multiple CLIs with different defaults. Use the with_defaults() class method to create instances with CLI-specific defaults, or provide defaults when creating the parent config model.
- Parameters:
- class qm_atlas.command_line.base_config.BaseInterfaceConfig(**data)[source]¶
Base configuration with common input and submission settings.
- Parameters:
input (CalculationInput)
submission_config (SubmissionConfig)
software_config (Path | None)
n_cores (int | None)
verbose (bool)
force_rerun (bool)
- input: CalculationInput¶
- submission_config: SubmissionConfig¶
- qm_atlas.command_line.base_config.apply_software_config(software_config_path)[source]¶
Apply a software config file by setting the env var and reloading SOFTWARE_CONFIG.
This should be called early in each CLI main() function after config loading. If software_config_path is provided, validates the file exists, sets the qm_atlas_SOFTWARE_CONFIG_FILE environment variable, and reloads the global SOFTWARE_CONFIG singleton.
- qm_atlas.command_line.base_config.setup_logging(verbose=False, log_file=None)[source]¶
Configure logging based on config verbosity level.
- qm_atlas.command_line.base_config.validate_results_dir(results_dir, create_if_missing=True)[source]¶
Validate and prepare the results directory.
- Parameters:
- Raises:
ValueError – If parent directory doesn’t exist or results_dir validation fails
- qm_atlas.command_line.base_config.get_input_worker_paths(cpd_dir)[source]¶
Searches for input sdf files under cpd_dir and returns a list of their paths.
- qm_atlas.command_line.base_config.get_reference_worker_paths(cpd_dir)[source]¶
Searches for reference sdf files under cpd_dir and returns a list of their paths.
- qm_atlas.command_line.base_config.get_conformer_property_worker_paths(cpd_dir)[source]¶
Searches for result sdf files under cpd_dir and returns a list of their paths.
- qm_atlas.command_line.base_config.get_cosmo_property_worker_paths(cpd_dir)[source]¶
Searches for conformer COSMO files under cpd_dir and returns a list of their paths.
- qm_atlas.command_line.base_config.get_solvent_screening_worker_paths(cpd_dir)[source]¶
Returns a single worker path per compound directory for solvent screening.
Solvent screening collects all neutral-state COSMO conformers in one call, so only one entry per compound directory is needed.
- qm_atlas.command_line.base_config.missing_reference_optimizations(cpd_dir, sdf_file, requested_configs)[source]¶
Return the requested optimization configs with no matching existing result.
This is the full picture behind
worker_path_completed()for reference optimization: an empty list means every requested setting is already present, a non-empty list is exactly the settings that still need to run (e.g. a newly added force constant).- Parameters:
cpd_dir (
CpdDir) – The owning compound directory.sdf_file (
Path) – The reference input file to inspect.requested_configs (
list[list[XtbOptions|JobexOptions|XtbTurbomoleOptions]]) – The requested optimization settings.
- Returns:
The subset of requested settings still to run.
- Return type:
- qm_atlas.command_line.base_config.worker_path_completed(cpd_dir, sdf_file, workflow_type, **kwargs)[source]¶
Return whether sdf_file already has results for workflow_type.
Workflows without a registered completeness check are never considered done.
- Parameters:
- Returns:
True if results already exist and the worker path can be skipped.
- Return type:
- qm_atlas.command_line.base_config.extract_worker_paths(calculation_input, workflow_type, skip_completed=False, **kwargs)[source]¶
Extract worker paths based on input configuration.
- Parameters:
calculation_input (
CalculationInput) – The resolved input configuration.workflow_type (
str) – The workflow whose worker paths are being built.skip_completed (
bool) – When True, drop worker paths whose results already exist (used to resume a partially completed run). Only applied to the compound-directory and results-directory branches; task-control slices are assumed to have been filtered when the task array was created.**kwargs – Additional keyword arguments passed to the workflow-specific checker.
- Returns:
The worker paths to process.
- Return type:
- qm_atlas.command_line.base_config.extract_cpd_dirs(calculation_input)[source]¶
Return the compound directories referenced by calculation_input.
Unlike
extract_worker_paths(), this resolves whole compound directories rather than per-conformer worker paths, which is what post-processing commands (collect, averaging, Boltzmann weights) operate on.- Parameters:
calculation_input (
CalculationInput) – The resolved input configuration.- Returns:
The unique compound directories to process.
- Return type:
list[CpdDir]