APIs for running MLflow Projects locally or remotely.
Exception thrown when executing a project fails.
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, use_temp_cwd=False, storage_dir=None, block=True)
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 version.
mlflow.projects.ExecutionException if a run launched in blocking mode is unsuccessful.
- 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_point as 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.
- use_temp_cwd – Only used if mode is “local” and uri is a local directory. If True, copies project to a temporary working directory before running it. Otherwise (the default), runs project using uri (the project’s path) as the working directory.
- storage_dir – Only used if mode is local. MLflow will download artifacts from distributed URIs passed to parameters of type ‘path’ to subdirectories of storage_dir.
- block – Whether or not to block while waiting for a run to complete. Defaults to True. Note that if block is 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.
A SubmittedRun exposing information (e.g. run ID) about the launched run.