Skip to content

Python API

add() returns Job; run() and retry() return Run. All expose the CLI result attributes (args, returncode, stdout, stderr). Job has id, name, and command; Run has id and name. For a matrix addition, Job.id and Job.name are None because the CLI returns only the job count. Other methods return CommandResult unless otherwise noted. Command options are generated from the rotari CLI schema.

Rotari.check(**options) returns a JSON readiness dict even when the project is not runnable. Rotari.wait(run) and Rotari.show(run_or_job) return a JSON dict; a list of runs or jobs returns a list of dicts in input order. Run offers wait(), show(), and cancel(wait=False); Job offers show(run=None), cancel(), suspend(), and resume(). These methods delegate to the creating client and invoke the CLI only when called. Rotari.cancel() cancels its project's active run, while Rotari.cancel(run) and Rotari.cancel(job) select a specific run or job; job lists are accepted by cancel, suspend, and resume. All control methods return CommandResult. See the Python client guide for target and active-run restrictions.

Rotari.add

Rotari.add(command: Sequence[str], **options: object) -> Job

Add a command to a queue.

Option Value Description
config str config file to use
executor str job executor (choices: local, lsf, pbs, sge, slurm, ssh)
executor_options Sequence[str] option passed to the executor (sbatch/qsub/bsub/ssh); each value is split into words by shell quoting rules; replaces the run's executor options for this job; may be repeated
output Sequence[str] stdout destination; stderr also goes here unless --error is specified; may be repeated
error Sequence[str] stderr destination; defaults to --output destinations; may be repeated
artifact Sequence[str] a file or directory the job writes or reads, recorded as an artifact candidate of each attempt besides the paths found statically in the job definition, which misses paths built at runtime; $ROTARI_ARRAY_TASK_ID, $ROTARI_JOB_DIR, and the job's --env and matrix variables expand; may be repeated
log_mode str internal log mode (choices: merge, separate)
open_mode str external output file mode (choices: append, truncate)
working_directory str working directory for the job; by default, the directory where rotari run or retry is started
env Sequence[str] environment variable for the job; may be repeated
job_name str job name label
stage str stage that contains the job
depends_on Sequence[str] name of a prerequisite job or stage; may be repeated
depends_on_finished Sequence[str] name of a prerequisite job or stage that must finish, whatever its result; may be repeated
timeout str stop the job this long after it starts, such as 90m or 2h; it then fails with exit code 124
retry str retry the job up to N times when it fails, instead of the run's --retry; 0 disables retries
retry_delay str wait this long before the job's first retry, such as 30s; retries are immediate by default
retry_backoff str multiply the retry delay by this factor for each further retry, such as 2
retry_max_delay str upper limit of the retry delay, such as 10m
array str create an array job range or selected tasks
matrix Sequence[str] expand a command into jobs from KEY=VALUE[,VALUE...] dimensions; may be repeated
matrix_exclude Sequence[str] exclude matrix combinations matching KEY=VALUE[,KEY=VALUE...]; requires --matrix and may be repeated
quiet bool suppress success output
dry_run bool print what the command would change, and the project revision, without writing
if_revision str apply only if the project is still at this revision, as printed by --dry-run

Rotari.run

Rotari.run(**options: object) -> Run

Execute queued commands, optionally selecting jobs from a run; jobs that depend on a selected job execute too.

Option Value Description
config str config file to use
run_id str build the run from this saved run without changing the next queue; without it, a result filter copies the latest run only into an empty queue and otherwise uses the queued jobs
to_project str start the run in this project instead, creating it if needed, from the selected jobs of the saved run (--run-id, else the latest run); all of them execute there and no result is carried
run_name str run name label
actor str who starts the run, such as an agent's name; recorded with the run and shown by show, runs, lineage, and the Web Activity page
note str why this run is made; recorded with the run and shown by show and lineage; add more later with rotari note
local_concurrency str local worker concurrency
batch_concurrency str scheduler job concurrency (Slurm/PBS/LSF/SGE)
retry str retry failed jobs up to N times; explicit cancellations are not retried
failed bool short form of --filter-failed; only execute failed jobs, others carry forward their previous result
unfinished bool short form of --filter-unfinished; only execute unfinished jobs, others carry forward their previous result
success bool short form of --filter-success; only execute successful jobs, others carry forward their previous result
job_ids Sequence[str] only execute this job and the jobs that depend on it, through --depends-on or --depends-on-finished; may be repeated; not with a result filter; others carry forward their previous result
job_name str only execute this job by name
stage str only execute jobs in this stage, narrowed by any result filter; others carry forward their previous result
matrix str only execute jobs of this matrix, named by its base job name, narrowed by any result filter; others carry forward their previous result
partial_array bool with a result filter, select array jobs per task instead of all-or-nothing (default true); pass =false to re-execute the whole array when any task matches
async_ bool return after starting the run
disconnect_action str when the client is killed or its terminal closes, detach or cancel (default detach); Ctrl-D or the end of terminal input always detaches (choices: detach, cancel)
quiet bool suppress progress and completion output
executor str execution executor override (choices: local, lsf, pbs, sge, slurm, ssh)
env str caller environment propagation mode (default ALL) (choices: ALL, NONE)
match_by str job identity matching (choices: job-id, fingerprint, id-and-fingerprint)
executor_options Sequence[str] option passed to the executor (sbatch/qsub/bsub/ssh) of jobs without their own; each value is split into words by shell quoting rules; may be repeated
ssh_concurrency str SSH executor concurrency
ssh_options Sequence[str] SSH executor dispatch options; may be repeated
slurm_concurrency str Slurm executor concurrency
slurm_options Sequence[str] Slurm executor dispatch options; may be repeated
slurm_submit_interval str minimum Slurm submission interval
slurm_submit_retry_limit str maximum retries for transient Slurm submission failures
pbs_concurrency str PBS executor concurrency
pbs_options Sequence[str] PBS executor dispatch options; may be repeated
pbs_submit_interval str minimum PBS submission interval
pbs_submit_retry_limit str maximum retries for transient PBS submission failures
lsf_concurrency str LSF executor concurrency
lsf_options Sequence[str] LSF executor dispatch options; may be repeated
lsf_submit_interval str minimum LSF submission interval
lsf_submit_retry_limit str maximum retries for transient LSF submission failures
sge_concurrency str SGE executor concurrency
sge_options Sequence[str] SGE executor dispatch options; may be repeated
sge_submit_interval str minimum SGE submission interval
sge_submit_retry_limit str maximum retries for transient SGE submission failures
filter_failed bool select jobs with a failed result
filter_unfinished bool select jobs without a finished result
filter_success bool select jobs with a successful result
filter_exit_code Sequence[str] select jobs with this exit code; may be repeated
filter_failure_kind Sequence[str] select jobs of this failure kind; may be repeated (choices: timeout, cancelled, blocked, oom, signal, error)
filter_diagnosis Sequence[str] select failed jobs matching a current diagnosis rule; may be repeated
filter_failure_cause Sequence[str] select failed jobs that failure summaries group under this cause; may be repeated
filter_changed bool select queued jobs whose definition changed from the reference run
filter_new bool select queued jobs with no matching job in the reference run
filter_host Sequence[str] select jobs run on a matching host; may be repeated
filter_started_after str select jobs started at or after this time
filter_started_before str select jobs started before this time
filter_finished_after str select jobs finished at or after this time
filter_finished_before str select jobs finished before this time
filter_longer_than str select jobs running at least this long
filter_shorter_than str select jobs running less than this long
filter_command str select jobs whose argv matches this Go regexp
filter_stage str select jobs in this stage; same as --stage
filter_not_stage Sequence[str] exclude jobs in this stage; may be repeated
filter_matrix str select jobs of this matrix, named by its base job name; same as --matrix
filter_not_matrix Sequence[str] exclude jobs of this matrix, named by its base job name; may be repeated
dry_run bool print what the command would change, and the project revision, without writing
if_revision str apply only if the project is still at this revision, as printed by --dry-run

Rotari.retry

Rotari.retry(**options: object) -> Run

Run failed and unfinished jobs; with --job-id, run those jobs; jobs that depend on them execute too.

Option Value Description
config str config file to use
run_id str build the retry from this saved run without changing the next queue; without it, retry copies the latest run only into an empty queue and otherwise uses the queued jobs
to_project str start the run in this project instead, creating it if needed, from the selected jobs of the saved run (--run-id, else the latest run); all of them execute there and no result is carried
run_name str run name label
actor str who starts the run, such as an agent's name; recorded with the run and shown by show, runs, lineage, and the Web Activity page
note str why this run is made; recorded with the run and shown by show and lineage; add more later with rotari note
local_concurrency str local worker concurrency
batch_concurrency str scheduler job concurrency (Slurm/PBS/LSF/SGE)
retry str retry failed jobs up to N times; explicit cancellations are not retried
failed bool only execute failed jobs, instead of failed and unfinished jobs; others carry forward their previous result
unfinished bool only execute unfinished jobs, instead of failed and unfinished jobs; others carry forward their previous result
success bool only execute successful jobs, instead of failed and unfinished jobs; others carry forward their previous result
job_ids Sequence[str] only execute this job and the jobs that depend on it, through --depends-on or --depends-on-finished, instead of failed and unfinished jobs; may be repeated
job_name str only execute this job by name
stage str only retry jobs in this stage
matrix str only retry jobs of this matrix, named by its base job name
partial_array bool with a result filter, select array jobs per task instead of all-or-nothing (default true); pass =false to re-execute the whole array when any task matches
async_ bool return after starting the run
disconnect_action str when the client is killed or its terminal closes, detach or cancel (default detach); Ctrl-D or the end of terminal input always detaches (choices: detach, cancel)
quiet bool suppress progress and completion output
executor str execution executor override (choices: local, lsf, pbs, sge, slurm, ssh)
env str caller environment propagation mode (default ALL) (choices: ALL, NONE)
match_by str job identity matching (choices: job-id, fingerprint, id-and-fingerprint)
executor_options Sequence[str] option passed to the executor (sbatch/qsub/bsub/ssh) of jobs without their own; each value is split into words by shell quoting rules; may be repeated
ssh_concurrency str SSH executor concurrency
ssh_options Sequence[str] SSH executor dispatch options; may be repeated
slurm_concurrency str Slurm executor concurrency
slurm_options Sequence[str] Slurm executor dispatch options; may be repeated
slurm_submit_interval str minimum Slurm submission interval
slurm_submit_retry_limit str maximum retries for transient Slurm submission failures
pbs_concurrency str PBS executor concurrency
pbs_options Sequence[str] PBS executor dispatch options; may be repeated
pbs_submit_interval str minimum PBS submission interval
pbs_submit_retry_limit str maximum retries for transient PBS submission failures
lsf_concurrency str LSF executor concurrency
lsf_options Sequence[str] LSF executor dispatch options; may be repeated
lsf_submit_interval str minimum LSF submission interval
lsf_submit_retry_limit str maximum retries for transient LSF submission failures
sge_concurrency str SGE executor concurrency
sge_options Sequence[str] SGE executor dispatch options; may be repeated
sge_submit_interval str minimum SGE submission interval
sge_submit_retry_limit str maximum retries for transient SGE submission failures
filter_failed bool select jobs with a failed result
filter_unfinished bool select jobs without a finished result
filter_success bool select jobs with a successful result
filter_exit_code Sequence[str] select jobs with this exit code; may be repeated
filter_failure_kind Sequence[str] select jobs of this failure kind; may be repeated (choices: timeout, cancelled, blocked, oom, signal, error)
filter_diagnosis Sequence[str] select failed jobs matching a current diagnosis rule; may be repeated
filter_failure_cause Sequence[str] select failed jobs that failure summaries group under this cause; may be repeated
filter_changed bool select queued jobs whose definition changed from the reference run
filter_new bool select queued jobs with no matching job in the reference run
filter_host Sequence[str] select jobs run on a matching host; may be repeated
filter_started_after str select jobs started at or after this time
filter_started_before str select jobs started before this time
filter_finished_after str select jobs finished at or after this time
filter_finished_before str select jobs finished before this time
filter_longer_than str select jobs running at least this long
filter_shorter_than str select jobs running less than this long
filter_command str select jobs whose argv matches this Go regexp
filter_stage str select jobs in this stage; same as --stage
filter_not_stage Sequence[str] exclude jobs in this stage; may be repeated
filter_matrix str select jobs of this matrix, named by its base job name; same as --matrix
filter_not_matrix Sequence[str] exclude jobs of this matrix, named by its base job name; may be repeated
dry_run bool print what the command would change, and the project revision, without writing
if_revision str apply only if the project is still at this revision, as printed by --dry-run

Rotari.reset

Rotari.reset() -> CommandResult

Discard the current, not-yet-run queue.

Option Value Description
config str config file to use
quiet bool suppress success output
dry_run bool print what the command would change, and the project revision, without writing
if_revision str apply only if the project is still at this revision, as printed by --dry-run

Rotari.wait

Rotari.wait(selector: Run | str | Sequence[Run | str] | None = None, **options: object) -> dict[str, object] | list[dict[str, object]]

Wait for a run by project, run name, or run id.

Option Value Description
config str config file to use
disconnect_action str when the wait client is killed or its terminal closes, detach or cancel selected runs (default detach); Ctrl-D or the end of terminal input always detaches (choices: detach, cancel)
run_id Sequence[str] run ID; may be repeated
timeout str maximum wait duration
until_failure bool return as soon as a job of the run has failed with no retry left, without waiting for the rest
quiet bool suppress normal progress and completion output; keep failure diagnostics and JSON results
all bool without a selector, wait for every active run in the basedir, not only those started from this shell

Rotari.show

Rotari.show(target: Run | Job | Sequence[Run] | Sequence[Job] | None = None, *, run: Run | str | None = None, **options: object) -> dict[str, object] | list[dict[str, object]]

Show details for a project, run, job, or attempt.

Option Value Description
config str config file to use
run_id str run ID or latest
queue bool show the current queue even when a run is selected
job_ids str job ID
job_name str job name
failed bool short form of --filter-failed
unfinished bool short form of --filter-unfinished
success bool short form of --filter-success
stage str show jobs in this stage only
matrix str show jobs of this matrix only, named by its base job name
logs bool print output logs for all jobs
failed_logs bool print output logs for failed jobs
no_logs bool show one job or attempt's details without logs or automatic following
stream str show both streams or select stdout/stderr
tail str print only the last N lines of each log, with --logs, --failed-logs, or a job's output
follow bool follow one selected log stream until the run completes
no_pager bool print logs directly instead of using a pager
report bool print a Markdown report: notes, a job table, and each job's evidence
artifacts bool list every artifact candidate of one job attempt instead of its logs
wide bool print the run or queue table in full: attempt IDs, submit times, expanded dependencies, whole commands, and the columns that are the same for every job
filter_failed bool select jobs with a failed result
filter_unfinished bool select jobs without a finished result
filter_success bool select jobs with a successful result
filter_exit_code Sequence[str] select jobs with this exit code; may be repeated
filter_failure_kind Sequence[str] select jobs of this failure kind; may be repeated (choices: timeout, cancelled, blocked, oom, signal, error)
filter_diagnosis Sequence[str] select failed jobs matching a current diagnosis rule; may be repeated
filter_failure_cause Sequence[str] select failed jobs that failure summaries group under this cause; may be repeated
filter_changed bool select queued jobs whose definition changed from the reference run
filter_new bool select queued jobs with no matching job in the reference run
filter_host Sequence[str] select jobs run on a matching host; may be repeated
filter_started_after str select jobs started at or after this time
filter_started_before str select jobs started before this time
filter_finished_after str select jobs finished at or after this time
filter_finished_before str select jobs finished before this time
filter_longer_than str select jobs running at least this long
filter_shorter_than str select jobs running less than this long
filter_command str select jobs whose argv matches this Go regexp
filter_stage str select jobs in this stage; same as --stage
filter_not_stage Sequence[str] exclude jobs in this stage; may be repeated
filter_matrix str select jobs of this matrix, named by its base job name; same as --matrix
filter_not_matrix Sequence[str] exclude jobs of this matrix, named by its base job name; may be repeated

rotari

Python client for the rotari command-line interface.

CommandResult dataclass

Result of one rotari CLI invocation.

json() -> object

Decode the first JSON value printed by the command.

RotariError

Bases: RuntimeError

A rotari command could not be completed.