Repository: Project-MONAI/MONAI
File: monai/bundle/scripts.py (Python)

Code before:
        python -m monai.bundle run --net %/data/other.json#net_arg ...

        # Set default args of `run` in a JSON / YAML file, help to record and simplify the command line.
        # Other args still can override the default args at runtime:
        python -m monai.bundle run --args_file "/workspace/data/args.json" --config_file <config path>

        # Set the workflow to other customized BundleWorkflow subclass:
        python -m monai.bundle run --workflow CustomizedWorkflow ...

    Args:
        workflow: specified bundle workflow name, should be a string or class, default to "ConfigWorkflow".
        args_file: a JSON or YAML file to provide default values for this API.
            so that the command line inputs can be simplified.
        kwargs: arguments to instantiate the workflow class.

    """

    _args = _update_args(args=args_file, workflow=workflow, **kwargs)
    _log_input_summary(tag="run", args=_args)
    (workflow_name,) = _pop_args(_args, workflow=ConfigWorkflow)
    if isinstance(workflow_name, str):
        workflow_class, has_built_in = optional_import("monai.bundle", name=f"{workflow_name}")  # search built-in
        if not has_built_in:
            workflow_class = locate(f"{workflow_name}")  # search dotted path
        if workflow_class is None:
            raise ValueError(f"can not locate specified workflow class: {workflow_name}.")
    elif issubclass(workflow_name, BundleWorkflow):
        workflow_class = workflow_name
    else:
        raise ValueError(f"`workflow` must be the bundle workflow class name, but got: {workflow_name}.")

    workflow_ = workflow_class(**_args)
    workflow_.initialize()
    workflow_.run()
    workflow_.finalize()


def verify_metadata(
    meta_file: str | Sequence[str] | None = None,
    filepath: PathLike | None = None,
    create_dir: bool | None = None,
    hash_val: str | None = None,
    hash_type: str | None = None,
    args_file: str | None = None,
    **kwargs: Any,
) -> None:
    """
    Verify the provided `metadata` file based on the predefined `schema`.
    `metadata` content must contain the `schema` field for the URL of schema file to download.
    The schema standard follows: http://json-schema.org/.


Review comment (suggestion):
```suggestion
            raise ValueError(f"Cannot locate specified workflow class: {workflow_name}.")
```

Code after:
        # Execute this module as a CLI entry:
        python -m monai.bundle run training --meta_file <meta path> --config_file <config path>

        # Override config values at runtime by specifying the component id and its new value:
        python -m monai.bundle run training --net#input_chns 1 ...

        # Override config values with another config file `/path/to/another.json`:
        python -m monai.bundle run evaluating --net %/path/to/another.json ...

        # Override config values with part content of another config file:
        python -m monai.bundle run training --net %/data/other.json#net_arg ...

        # Set default args of `run` in a JSON / YAML file, help to record and simplify the command line.
        # Other args still can override the default args at runtime:
        python -m monai.bundle run --args_file "/workspace/data/args.json" --config_file <config path>

    Args:
        run_id: ID name of the expected config expression to run, default to "run".
        init_id: ID name of the expected config expression to initialize before running, default to "initialize".
        final_id: ID name of the expected config expression to finalize after running, default to "finalize".
        meta_file: filepath of the metadata file, if it is a list of file paths, the content of them will be merged.
            Default to "configs/metadata.json", which is commonly used for bundles in MONAI model zoo.
        config_file: filepath of the config file, if `None`, must be provided in `args_file`.
            if it is a list of file paths, the content of them will be merged.
        logging_file: config file for `logging` module in the program. for more details:
            https://docs.python.org/3/library/logging.config.html#logging.config.fileConfig.
            Default to "configs/logging.conf", which is commonly used for bundles in MONAI model zoo.
        tracking: if not None, enable the experiment tracking at runtime with optionally configurable and extensible.
            if "mlflow", will add `MLFlowHandler` to the parsed bundle with default tracking settings,
            if other string, treat it as file path to load the tracking settings.
            if `dict`, treat it as tracking settings.
            will patch the target config content with `tracking handlers` and the top-level items of `configs`.
            for detailed usage examples, plesae check the tutorial:
            https://github.com/Project-MONAI/tutorials/blob/main/experiment_management/bundle_integrate_mlflow.ipynb.
        args_file: a JSON or YAML file to provide default values for `runner_id`, `meta_file`,
            `config_file`, `logging`, and override pairs. so that the command line inputs can be simplified.
        override: id-value pairs to override or add the corresponding config content.
            e.g. ``--net#input_chns 42``, ``--net %/data/other.json#net_arg``.

    """

    _args = _update_args(
        args=args_file,
        run_id=run_id,
        init_id=init_id,
        final_id=final_id,
        meta_file=meta_file,
        config_file=config_file,
        logging_file=logging_file,
        tracking=tracking,
        **override,