Note
This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the user guide for the big picture.
hopla.cli.main¶
- hopla.cli.main()[source]¶
Command-line interface for automated job execution with hopla.
This function loads a TOML configuration file, initializes a hopla executor, and submits jobs either individually or in chunks depending on the configuration. It then runs the executor with a specified maximum number of jobs and writes a report to disk.
Workflow¶
Parse CLI arguments using argparse.
Load the TOML configuration file with tomllib.
Initialize a hopla.Executor with environment parameters.
Extract commands from the configuration:
If multi is defined, split commands into chunks and submit them as delayed submissions.
Otherwise, submit commands directly.
Run the executor with the specified maximum number of jobs.
Write a textual report to report.txt inside the executor’s folder.
TOML Configuration¶
The configuration file is structured into sections:
[project] # Name of the project. name = "str" # Person responsible for running the analysis. operator = "str" # Date of the experiment in DD/MM/YYYY format. date = "str" [inputs] # Commands to execute. Can be a Python expression string (e.g., # "sleep {k}") or a list of commands. commands = "str or list" # Additional parameters passed to the container execution command # (e.g., "--cleanenv"). parameters = "str" [environment] # Cluster type (e.g., "pbs"). cluster = "str" # Working directory for job execution (e.g., "/tmp/hopla"). folder = "str" # Queue or partition name (e.g., "Nspin_short"). queue = "str" # Maximum walltime in hours for each job. walltime = "int" # Number of CPUs allocated per job. n_cpus = "int" # Path to container image used for execution. image = "str" [config] # If true, simulate job submission without executing. dryrun = "bool" # Delay in seconds between submissions. delay_s = "int" # If true, enable verbose logging. verbose = "bool"
- Raises:
- ValueError
If ‘data.tsv’ is missing.
Notes
The multi section should define n_splits to control chunking.
The Config context manager is used to apply configuration settings during execution.
Examples
>>> hoplactl --config experiment.toml --njobs 5