srunx.cli package#

Submodules#

srunx.cli.main module#

Main CLI interface for srunx.

class srunx.cli.main.DebugCallback[source]#

Bases: Callback

Callback to display rendered SLURM scripts in debug mode.

__init__()[source]#
on_job_submitted(job)[source]#

Display the rendered SLURM script when a job is submitted.

Return type:

None

srunx.cli.main.submit(command, name='job', log_dir=None, work_dir=None, nodes=1, gpus_per_node=0, ntasks_per_node=1, cpus_per_task=1, memory=None, time=None, nodelist=None, partition=None, conda=None, venv=None, container=None, container_runtime=None, no_container=False, env=None, dry_run=False, wait=False, slack=False, template=None, verbose=False)[source]#

Submit a SLURM job.

Return type:

None

srunx.cli.main.status(job_id)[source]#

Check job status.

Return type:

None

srunx.cli.main.list_jobs(show_gpus=False, format='table')[source]#

List user’s jobs in the queue.

Return type:

None

Examples

srunx list srunx list –show-gpus srunx list –format json srunx list –show-gpus –format json

srunx.cli.main.cancel(job_id)[source]#

Cancel a running job.

Return type:

None

srunx.cli.main.resources(partition=None, format='table')[source]#

Display current GPU resource availability.

Return type:

None

Examples

srunx resources srunx resources –partition gpu srunx resources –format json srunx resources –partition gpu –format json

srunx.cli.main.logs(job_id, follow=False, last=None, job_name=None)[source]#

Display job logs with optional real-time streaming.

Return type:

None

srunx.cli.main.flow_run(yaml_file, dry_run=False, slack=False, debug=False, from_job=None, to_job=None, job=None)[source]#

Execute workflow from YAML file.

Return type:

None

srunx.cli.main.flow_validate(yaml_file)[source]#

Validate workflow YAML file.

Return type:

None

srunx.cli.main.config_show()[source]#

Show current configuration.

Return type:

None

srunx.cli.main.config_paths()[source]#

Show configuration file paths.

Return type:

None

srunx.cli.main.config_init(force=False)[source]#

Initialize configuration file.

Return type:

None

srunx.cli.main.template_list()[source]#

List all available job templates.

Return type:

None

srunx.cli.main.template_show(name)[source]#

Show template details and content.

Return type:

None

srunx.cli.main.template_apply(name, command, job_name='job', nodes=1, gpus_per_node=1, ntasks_per_node=1, cpus_per_task=1, memory=None, time=None, partition=None, conda=None, venv=None, container=None, container_runtime=None, no_container=False, wait=False, slack=False)[source]#

Apply a template and submit a job.

Return type:

None

srunx.cli.main.history(limit=50)[source]#

Show job execution history.

Return type:

None

srunx.cli.main.report(from_date=None, to_date=None, workflow=None)[source]#

Generate job execution report.

Return type:

None

srunx.cli.main.main()[source]#

Main entry point for the CLI.

Return type:

None

srunx.cli.monitor module#

Monitor subcommands for jobs, resources, and cluster status.

srunx.cli.monitor.monitor_jobs(job_ids=None, all_jobs=False, schedule=None, interval=60, timeout=None, notify=None, continuous=False)[source]#

Monitor specific jobs until completion or send periodic reports.

Return type:

None

 Modes:

State change detection (default): Monitor until jobs complete - Example: srunx monitor jobs 12345 - Example: srunx monitor jobs –all –notify $WEBHOOK

Periodic reporting (–schedule): Send job status reports on schedule - Example: srunx monitor jobs 12345 67890 –schedule 10m –notify $WEBHOOK - Example: srunx monitor jobs –all –schedule 30m –notify $WEBHOOK

srunx.cli.monitor.monitor_resources(min_gpus=None, partition=None, interval=60, timeout=None, notify=None, continuous=False)[source]#

Monitor GPU resources until available or continuously.

 .. rubric:: Examples

# Wait for 4 GPUs srunx monitor resources –min-gpus 4

# Continuous monitoring with notifications srunx monitor resources –min-gpus 2 –continuous –notify $WEBHOOK

Return type:

None

srunx.cli.monitor.monitor_cluster(schedule, notify, include=None, partition=None, user=None, timeframe='24h', daemon=True)[source]#

Send periodic cluster status reports to Slack.

 .. rubric:: Examples

# Hourly cluster reports srunx monitor cluster –schedule 1h –notify $WEBHOOK

Return type:

None

# Daily report at 9am with specific sections srunx monitor cluster –schedule “0 9 * * *” –notify $WEBHOOK

–include jobs,resources,running

srunx.cli.workflow module#

CLI interface for workflow management.

srunx.cli.workflow.execute_yaml(ctx, yaml_file=None, validate=False, dry_run=False, log_level='INFO', slack=False, from_job=None, to_job=None, job=None)[source]#

Execute workflow from YAML file.

Return type:

None

srunx.cli.workflow.run_command(yaml_file, validate=False, dry_run=False, log_level='INFO', slack=False, from_job=None, to_job=None, job=None)[source]#

Execute workflow from YAML file.

Return type:

None

srunx.cli.workflow.validate_command(yaml_file, log_level='INFO')[source]#

Validate workflow YAML file without executing.

Return type:

None

srunx.cli.workflow.main()[source]#

Main entry point for workflow CLI.

Return type:

None

Module contents#

Command-line interface for srunx.

srunx.cli.main()[source]#

Main entry point for the CLI.

Return type:

None