mmirage.cli β Command-Line InterfaceΒΆ
Command-line interface for MMIRAGE pipeline.
- mmirage.cli.run_local(config_path, shard_id=None, collect_stats=False, export_prompts_path=None)[source]ΒΆ
Run one shard in the current Python environment.
- Parameters:
config_path (str) β Absolute path to the MMIRAGE YAML config file.
shard_id (int | None) β Optional shard id to inject via SLURM_ARRAY_TASK_ID.
collect_stats (bool) β If True, enable GPU utilization polling in the shard process.
export_prompts_path (str | None) β Optional file path for exporting batch prompts instead of submitting them.
- Returns:
Process return code from shard execution.
- Return type:
- mmirage.cli.launch_pipeline(cfg, config_path, force_retry=False, require_completion=False, collect_stats=False, export_prompts_path=None)[source]ΒΆ
Launch the pipeline according to execution mode and retry settings.
- Parameters:
cfg (MMirageConfig) β Parsed MMIRAGE configuration object.
config_path (str) β Absolute path to the MMIRAGE YAML config file.
force_retry (bool) β If True, enable retry orchestration regardless of config flag.
require_completion (bool) β If True, wait for completion and verify shard status before returning success in SLURM mode when auto-retry is off.
collect_stats (bool) β If True, enable GPU utilization polling on compute nodes.
export_prompts_path (str | None) β Optional file path for exporting batch prompts instead of submitting them.
- Returns:
0 on success, 1 on failure.
- Return type:
Exit code
- mmirage.cli.configure_logging(level)[source]ΒΆ
Configure root logging.
- Parameters:
level (str) β Root log level name.
- Return type:
None
Attach common CLI arguments to a subcommand parser.
- Parameters:
parser (ArgumentParser) β Subcommand parser receiving shared arguments.
- Return type:
None
- mmirage.cli.add_metadata_path_argument(parser)[source]ΒΆ
Attach the batch receipt path argument to a subcommand parser.
- Parameters:
parser (ArgumentParser) β Subcommand parser receiving the argument.
- Return type:
None
- mmirage.cli.uses_batch_api(cfg)[source]ΒΆ
Return True when the config declares at least one batch_api processor.
- Parameters:
cfg (MMirageConfig) β Parsed MMIRAGE configuration object.
- Return type:
- mmirage.cli.build_argparser()[source]ΒΆ
Build the CLI parser.
- Returns:
Configured top-level argparse parser.
- Return type:
- mmirage.cli.log_merge_reports(reports)[source]ΒΆ
Log merge summary for one or more datasets.
- Parameters:
reports (List[MergeReport])
- Return type:
None
- mmirage.cli.parse_shard_ids(raw_value, num_shards=None)[source]ΒΆ
Parse a comma-separated shard id list.
- mmirage.cli.handle_run(args, cfg, config_path)[source]ΒΆ
Handle the canonical run command.
- Parameters:
args (Namespace) β Parsed CLI namespace.
cfg (MMirageConfig) β Parsed MMIRAGE configuration object.
config_path (str) β Absolute path to the MMIRAGE YAML config file.
- Returns:
Exit code for the run operation.
- Return type:
- mmirage.cli.handle_submit(args, cfg, config_path)[source]ΒΆ
Submit a SLURM array job and optionally wait.
- Parameters:
args (Namespace) β Parsed CLI namespace.
cfg (MMirageConfig) β Parsed MMIRAGE configuration object.
config_path (str) β Absolute path to the MMIRAGE YAML config file.
- Returns:
Exit code for submission/wait outcome.
- Return type:
- mmirage.cli.handle_check(args, cfg, config_path)[source]ΒΆ
Inspect shard status and optionally submit retries.
For batch_api configs, shard state only records submission, so the provider batch status is reported from the metadata receipts instead.
- Parameters:
args (Namespace) β Parsed CLI namespace.
cfg (MMirageConfig) β Parsed MMIRAGE configuration object.
config_path (str) β Absolute path to the MMIRAGE YAML config file.
- Returns:
Exit code based on shard status and optional retry submission.
- Return type:
- mmirage.cli.handle_retry(args, cfg, config_path)[source]ΒΆ
Submit retries for failed shards only.
- Parameters:
args (Namespace) β Parsed CLI namespace.
cfg (MMirageConfig) β Parsed MMIRAGE configuration object.
config_path (str) β Absolute path to the MMIRAGE YAML config file.
- Returns:
Exit code for retry submission outcome.
- Return type:
- mmirage.cli.handle_stats(args, cfg, _config_path)[source]ΒΆ
Print per-shard benchmark statistics and aggregate totals.
- Parameters:
args (Namespace) β Parsed CLI namespace.
cfg (MMirageConfig) β Parsed MMIRAGE configuration object.
_config_path (str) β Absolute path to the MMIRAGE YAML config file (not needed here).
- Returns:
0 always (stats are informational).
- Return type:
Exit code
- mmirage.cli.handle_merge(args, cfg, _config_path)[source]ΒΆ
Merge shard outputs defined in config.loading_params.datasets.
For batch_api configs, the shards only hold submission placeholders, so the completed provider results are retrieved and merged into βoutput-path.
- Parameters:
args (Namespace) β Parsed CLI namespace.
cfg (MMirageConfig) β Parsed MMIRAGE configuration object.
_config_path (str) β Absolute path to the MMIRAGE YAML config file (not needed here).
- Returns:
Exit code for merge outcome.
- Return type: