APIs for running MLflow projects locally or remotely.
run(uri, entry_point='main', version=None, parameters=None, experiment_id=None, mode=None, cluster_spec=None, git_username=None, git_password=None, use_conda=True, storage_dir=None, block=True, run_id=None)
Run an MLflow project from the given URI.
Supports downloading projects from Git URIs with a specified version, or copying them from the file system. For Git-based projects, a commit can be specified as the
mlflow.projects.ExecutionException – if a run launched in blocking mode is unsuccessful.
- uri – URI of project to run. Expected to be either a relative/absolute local filesystem path or a git repository URI (e.g. https://github.com/mlflow/mlflow-example) pointing to a project directory containing an MLproject file.
- entry_point – Entry point to run within the project. If no entry point with the specified
name is found, attempts to run the project file
entry_pointas a script, using “python” to run .py files and the default shell (specified by environment variable $SHELL) to run .sh files.
- experiment_id – ID of experiment under which to launch the run.
- mode – Execution mode for the run. Can be set to “local” or “databricks”.
- cluster_spec – Path to JSON file describing the cluster to use when launching a run on Databricks.
- git_username – Username for HTTP(S) authentication with Git.
- git_password – Password for HTTP(S) authentication with Git.
- use_conda – If True (the default), creates a new Conda environment for the run and installs project dependencies within that environment. Otherwise, runs the project in the current environment without installing any project dependencies.
- storage_dir – Only used if
modeis local. MLflow will download artifacts from distributed URIs passed to parameters of type ‘path’ to subdirectories of
- block – Whether or not to block while waiting for a run to complete. Defaults to True.
Note that if
blockis False and mode is “local”, this method will return, but the current process will block when exiting until the local run completes. If the current process is interrupted, any asynchronous runs launched via this method will be terminated.
- run_id – Note: this argument is used internally by the MLflow project APIs and should not be specified. If specified, the given run ID will be used instead of creating a new run.
SubmittedRunexposing information (e.g. run ID) about the launched run. The returned
SubmittedRunis not thread-safe.