We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Missing doc string for `run_name`
There is missing doc string in public API for `mlflow.create_run` method

https://github.com/mlflow/mlflow/blob/f4869beec5cd2220d1bf01861d80f7145a8601bf/mlflow/tracking/fluent.py#L45-L70

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `mlflow/tracking/fluent.py`
Content:
```
1 """
2 Internal module implementing the fluent API, allowing management of an active
3 MLflow run. This module is exposed to users at the top-level :py:mod:`mlflow` module.
4 """
5 
6 from __future__ import print_function
7 
8 import atexit
9 import numbers
10 import os
11 import sys
12 import time
13 
14 from mlflow.entities import Experiment, Run, SourceType
15 from mlflow.utils import env
16 from mlflow.utils.databricks_utils import is_in_databricks_notebook, get_notebook_id, \
17     get_notebook_path, get_webapp_url
18 from mlflow.utils.validation import _validate_run_id
19 from mlflow.tracking.service import get_service
20 
21 
22 _EXPERIMENT_ID_ENV_VAR = "MLFLOW_EXPERIMENT_ID"
23 _RUN_ID_ENV_VAR = "MLFLOW_RUN_ID"
24 _active_run = None
25 _TAG_MLFLOW_DATABRICKS_NOTEBOOK_ID = "mlflow.databricks.notebookID"
26 _TAG_MLFLOW_DATABRICKS_NOTEBOOK_PATH = "mlflow.databricks.notebookPath"
27 _TAG_MLFLOW_DATABRICKS_WEBAPP_URL = "mlflow.databricks.webappURL"
28 
29 
30 class ActiveRun(Run):  # pylint: disable=W0223
31     """Wrapper around :py:class:`mlflow.entities.Run` to allow using python `with` syntax."""
32     def __init__(self, run):
33         Run.__init__(self, run.info, run.data)
34 
35     def __enter__(self):
36         return self
37 
38     def __exit__(self, exc_type, exc_val, exc_tb):
39         status = "FINISHED" if exc_type is None else "FAILED"
40         end_run(status)
41         return exc_type is None
42 
43 
44 def start_run(run_uuid=None, experiment_id=None, source_name=None, source_version=None,
45               entry_point_name=None, source_type=None, run_name=None):
46     """
47     Start a new MLflow run, setting it as the active run under which metrics and params
48     will be logged. The return value can be used as a context manager within a ``with`` block;
49     otherwise, ``end_run()`` must be called to terminate the current run. If ``run_uuid``
50     is passed or the ``MLFLOW_RUN_ID`` environment variable is set, ``start_run`` attempts to
51     resume a run with the specified run ID (with ``run_uuid`` taking precedence over
52     ``MLFLOW_RUN_ID``), and other parameters are ignored.
53 
54     :param run_uuid: If specified, get the run with the specified UUID and log metrics
55                      and params under that run. The run's end time is unset and its status
56                      is set to running, but the run's other attributes remain unchanged
57                      (the run's ``source_version``, ``source_type``, etc. are not changed).
58     :param experiment_id: Used only when ``run_uuid`` is unspecified. ID of the experiment under
59                           which to create the current run. If unspecified, the run is created under
60                           a new experiment with a randomly generated name.
61     :param source_name: Name of the source file or URI of the project to be associated with the run.
62                         Defaults to the current file if none provided.
63     :param source_version: Optional Git commit hash to associate with the run.
64     :param entry_point_name: Optional name of the entry point for to the current run.
65     :param source_type: Integer enum value describing the type of the run
66                         ("local", "project", etc.). Defaults to
67                         ``mlflow.entities.SourceType.LOCAL``.
68     :return: :py:class:`mlflow.ActiveRun` object that acts as a context manager wrapping
69              the run's state.
70     """
71     global _active_run
72     if _active_run:
73         raise Exception("Run with UUID %s is already active, unable to start nested "
74                         "run" % _active_run.info.run_uuid)
75     existing_run_uuid = run_uuid or os.environ.get(_RUN_ID_ENV_VAR, None)
76     if existing_run_uuid:
77         _validate_run_id(existing_run_uuid)
78         active_run_obj = get_service().get_run(existing_run_uuid)
79     else:
80         exp_id_for_run = experiment_id or _get_experiment_id()
81         if is_in_databricks_notebook():
82             databricks_tags = {}
83             notebook_id = get_notebook_id()
84             notebook_path = get_notebook_path()
85             webapp_url = get_webapp_url()
86             if notebook_id is not None:
87                 databricks_tags[_TAG_MLFLOW_DATABRICKS_NOTEBOOK_ID] = notebook_id
88             if notebook_path is not None:
89                 databricks_tags[_TAG_MLFLOW_DATABRICKS_NOTEBOOK_PATH] = notebook_path
90             if webapp_url is not None:
91                 databricks_tags[_TAG_MLFLOW_DATABRICKS_WEBAPP_URL] = webapp_url
92             active_run_obj = get_service().create_run(
93                 experiment_id=exp_id_for_run,
94                 run_name=run_name,
95                 source_name=notebook_path,
96                 source_version=source_version or _get_source_version(),
97                 entry_point_name=entry_point_name,
98                 source_type=SourceType.NOTEBOOK,
99                 tags=databricks_tags)
100         else:
101             active_run_obj = get_service().create_run(
102                 experiment_id=exp_id_for_run,
103                 run_name=run_name,
104                 source_name=source_name or _get_source_name(),
105                 source_version=source_version or _get_source_version(),
106                 entry_point_name=entry_point_name,
107                 source_type=source_type or _get_source_type())
108     _active_run = ActiveRun(active_run_obj)
109     return _active_run
110 
111 
112 def end_run(status="FINISHED"):
113     global _active_run
114     if _active_run:
115         get_service().set_terminated(_active_run.info.run_uuid, status)
116         # Clear out the global existing run environment variable as well.
117         env.unset_variable(_RUN_ID_ENV_VAR)
118         _active_run = None
119 atexit.register(end_run)
120 
121 
122 def active_run():
123     """Return the currently active ``Run``, or None if no such run exists."""
124     return _active_run
125 
126 
127 def log_param(key, value):
128     """
129     Log the passed-in parameter under the current run, creating a run if necessary.
130 
131     :param key: Parameter name (string)
132     :param value: Parameter value (string, but will be string-ified if not)
133     """
134     run_id = _get_or_start_run().info.run_uuid
135     get_service().log_param(run_id, key, value)
136 
137 
138 def set_tag(key, value):
139     """
140     Sets the passed-in tag under the current run, creating a run if necessary.
141 
142     :param key: Tag name (string)
143     :param value: Tag value (string, but will be string-ified if not)
144     """
145     run_id = _get_or_start_run().info.run_uuid
146     get_service().set_tag(run_id, key, value)
147 
148 
149 def log_metric(key, value):
150     """
151     Log the passed-in metric under the current run, creating a run if necessary.
152 
153     :param key: Metric name (string).
154     :param value: Metric value (float).
155     """
156     if not isinstance(value, numbers.Number):
157         print("WARNING: The metric {}={} was not logged because the value is not a number.".format(
158             key, value), file=sys.stderr)
159         return
160     run_id = _get_or_start_run().info.run_uuid
161     get_service().log_metric(run_id, key, value, int(time.time()))
162 
163 
164 def log_artifact(local_path, artifact_path=None):
165     """Log a local file or directory as an artifact of the currently active run."""
166     artifact_uri = _get_or_start_run().info.artifact_uri
167     get_service().log_artifact(artifact_uri, local_path, artifact_path)
168 
169 
170 def log_artifacts(local_dir, artifact_path=None):
171     """Log all the contents of a local directory as artifacts of the run."""
172     artifact_uri = _get_or_start_run().info.artifact_uri
173     get_service().log_artifacts(artifact_uri, local_dir, artifact_path)
174 
175 
176 def create_experiment(name, artifact_location=None):
177     return get_service().create_experiment(name, artifact_location)
178 
179 
180 def get_artifact_uri():
181     """
182     Return the artifact URI of the currently active run. Calls to ``log_artifact`` and
183     ``log_artifacts`` write artifact(s) to subdirectories of the returned URI.
184     """
185     return _get_or_start_run().info.artifact_uri
186 
187 
188 def _get_or_start_run():
189     if _active_run:
190         return _active_run
191     return start_run()
192 
193 
194 def _get_main_file():
195     if len(sys.argv) > 0:
196         return sys.argv[0]
197     return None
198 
199 
200 def _get_source_name():
201     main_file = _get_main_file()
202     if main_file is not None:
203         return main_file
204     return "<console>"
205 
206 
207 def _get_source_version():
208     main_file = _get_main_file()
209     if main_file is not None:
210         return _get_git_commit(main_file)
211     return None
212 
213 
214 def _get_source_type():
215     return SourceType.LOCAL
216 
217 
218 def _get_experiment_id():
219     return int(env.get_env(_EXPERIMENT_ID_ENV_VAR) or Experiment.DEFAULT_EXPERIMENT_ID)
220 
221 
222 def _get_git_commit(path):
223     try:
224         from git import Repo, InvalidGitRepositoryError, GitCommandNotFound, NoSuchPathError
225     except ImportError as e:
226         print("Notice: failed to import Git (the git executable is probably not on your PATH),"
227               " so Git SHA is not available. Error: %s" % e, file=sys.stderr)
228         return None
229     try:
230         if os.path.isfile(path):
231             path = os.path.dirname(path)
232         repo = Repo(path, search_parent_directories=True)
233         commit = repo.head.commit.hexsha
234         return commit
235     except (InvalidGitRepositoryError, GitCommandNotFound, ValueError, NoSuchPathError):
236         return None
237
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/mlflow/tracking/fluent.py b/mlflow/tracking/fluent.py
--- a/mlflow/tracking/fluent.py
+++ b/mlflow/tracking/fluent.py
@@ -57,7 +57,7 @@
                      (the run's ``source_version``, ``source_type``, etc. are not changed).
     :param experiment_id: Used only when ``run_uuid`` is unspecified. ID of the experiment under
                           which to create the current run. If unspecified, the run is created under
-                          a new experiment with a randomly generated name.
+                          default experiment.
     :param source_name: Name of the source file or URI of the project to be associated with the run.
                         Defaults to the current file if none provided.
     :param source_version: Optional Git commit hash to associate with the run.
@@ -65,6 +65,7 @@
     :param source_type: Integer enum value describing the type of the run
                         ("local", "project", etc.). Defaults to
                         ``mlflow.entities.SourceType.LOCAL``.
+    :param run_name: Used only when ``run_uuid`` is unspecified. Desired name of new run created.
     :return: :py:class:`mlflow.ActiveRun` object that acts as a context manager wrapping
              the run's state.
     """

{"golden_diff": "diff --git a/mlflow/tracking/fluent.py b/mlflow/tracking/fluent.py\n--- a/mlflow/tracking/fluent.py\n+++ b/mlflow/tracking/fluent.py\n@@ -57,7 +57,7 @@\n                      (the run's ``source_version``, ``source_type``, etc. are not changed).\n     :param experiment_id: Used only when ``run_uuid`` is unspecified. ID of the experiment under\n                           which to create the current run. If unspecified, the run is created under\n-                          a new experiment with a randomly generated name.\n+                          default experiment.\n     :param source_name: Name of the source file or URI of the project to be associated with the run.\n                         Defaults to the current file if none provided.\n     :param source_version: Optional Git commit hash to associate with the run.\n@@ -65,6 +65,7 @@\n     :param source_type: Integer enum value describing the type of the run\n                         (\"local\", \"project\", etc.). Defaults to\n                         ``mlflow.entities.SourceType.LOCAL``.\n+    :param run_name: Used only when ``run_uuid`` is unspecified. Desired name of new run created.\n     :return: :py:class:`mlflow.ActiveRun` object that acts as a context manager wrapping\n              the run's state.\n     \"\"\"\n", "issue": "Missing doc string for `run_name`\nThere is missing doc string in public API for `mlflow.create_run` method\r\n\r\nhttps://github.com/mlflow/mlflow/blob/f4869beec5cd2220d1bf01861d80f7145a8601bf/mlflow/tracking/fluent.py#L45-L70\n", "before_files": [{"content": "\"\"\"\nInternal module implementing the fluent API, allowing management of an active\nMLflow run. This module is exposed to users at the top-level :py:mod:`mlflow` module.\n\"\"\"\n\nfrom __future__ import print_function\n\nimport atexit\nimport numbers\nimport os\nimport sys\nimport time\n\nfrom mlflow.entities import Experiment, Run, SourceType\nfrom mlflow.utils import env\nfrom mlflow.utils.databricks_utils import is_in_databricks_notebook, get_notebook_id, \\\n    get_notebook_path, get_webapp_url\nfrom mlflow.utils.validation import _validate_run_id\nfrom mlflow.tracking.service import get_service\n\n\n_EXPERIMENT_ID_ENV_VAR = \"MLFLOW_EXPERIMENT_ID\"\n_RUN_ID_ENV_VAR = \"MLFLOW_RUN_ID\"\n_active_run = None\n_TAG_MLFLOW_DATABRICKS_NOTEBOOK_ID = \"mlflow.databricks.notebookID\"\n_TAG_MLFLOW_DATABRICKS_NOTEBOOK_PATH = \"mlflow.databricks.notebookPath\"\n_TAG_MLFLOW_DATABRICKS_WEBAPP_URL = \"mlflow.databricks.webappURL\"\n\n\nclass ActiveRun(Run):  # pylint: disable=W0223\n    \"\"\"Wrapper around :py:class:`mlflow.entities.Run` to allow using python `with` syntax.\"\"\"\n    def __init__(self, run):\n        Run.__init__(self, run.info, run.data)\n\n    def __enter__(self):\n        return self\n\n    def __exit__(self, exc_type, exc_val, exc_tb):\n        status = \"FINISHED\" if exc_type is None else \"FAILED\"\n        end_run(status)\n        return exc_type is None\n\n\ndef start_run(run_uuid=None, experiment_id=None, source_name=None, source_version=None,\n              entry_point_name=None, source_type=None, run_name=None):\n    \"\"\"\n    Start a new MLflow run, setting it as the active run under which metrics and params\n    will be logged. The return value can be used as a context manager within a ``with`` block;\n    otherwise, ``end_run()`` must be called to terminate the current run. If ``run_uuid``\n    is passed or the ``MLFLOW_RUN_ID`` environment variable is set, ``start_run`` attempts to\n    resume a run with the specified run ID (with ``run_uuid`` taking precedence over\n    ``MLFLOW_RUN_ID``), and other parameters are ignored.\n\n    :param run_uuid: If specified, get the run with the specified UUID and log metrics\n                     and params under that run. The run's end time is unset and its status\n                     is set to running, but the run's other attributes remain unchanged\n                     (the run's ``source_version``, ``source_type``, etc. are not changed).\n    :param experiment_id: Used only when ``run_uuid`` is unspecified. ID of the experiment under\n                          which to create the current run. If unspecified, the run is created under\n                          a new experiment with a randomly generated name.\n    :param source_name: Name of the source file or URI of the project to be associated with the run.\n                        Defaults to the current file if none provided.\n    :param source_version: Optional Git commit hash to associate with the run.\n    :param entry_point_name: Optional name of the entry point for to the current run.\n    :param source_type: Integer enum value describing the type of the run\n                        (\"local\", \"project\", etc.). Defaults to\n                        ``mlflow.entities.SourceType.LOCAL``.\n    :return: :py:class:`mlflow.ActiveRun` object that acts as a context manager wrapping\n             the run's state.\n    \"\"\"\n    global _active_run\n    if _active_run:\n        raise Exception(\"Run with UUID %s is already active, unable to start nested \"\n                        \"run\" % _active_run.info.run_uuid)\n    existing_run_uuid = run_uuid or os.environ.get(_RUN_ID_ENV_VAR, None)\n    if existing_run_uuid:\n        _validate_run_id(existing_run_uuid)\n        active_run_obj = get_service().get_run(existing_run_uuid)\n    else:\n        exp_id_for_run = experiment_id or _get_experiment_id()\n        if is_in_databricks_notebook():\n            databricks_tags = {}\n            notebook_id = get_notebook_id()\n            notebook_path = get_notebook_path()\n            webapp_url = get_webapp_url()\n            if notebook_id is not None:\n                databricks_tags[_TAG_MLFLOW_DATABRICKS_NOTEBOOK_ID] = notebook_id\n            if notebook_path is not None:\n                databricks_tags[_TAG_MLFLOW_DATABRICKS_NOTEBOOK_PATH] = notebook_path\n            if webapp_url is not None:\n                databricks_tags[_TAG_MLFLOW_DATABRICKS_WEBAPP_URL] = webapp_url\n            active_run_obj = get_service().create_run(\n                experiment_id=exp_id_for_run,\n                run_name=run_name,\n                source_name=notebook_path,\n                source_version=source_version or _get_source_version(),\n                entry_point_name=entry_point_name,\n                source_type=SourceType.NOTEBOOK,\n                tags=databricks_tags)\n        else:\n            active_run_obj = get_service().create_run(\n                experiment_id=exp_id_for_run,\n                run_name=run_name,\n                source_name=source_name or _get_source_name(),\n                source_version=source_version or _get_source_version(),\n                entry_point_name=entry_point_name,\n                source_type=source_type or _get_source_type())\n    _active_run = ActiveRun(active_run_obj)\n    return _active_run\n\n\ndef end_run(status=\"FINISHED\"):\n    global _active_run\n    if _active_run:\n        get_service().set_terminated(_active_run.info.run_uuid, status)\n        # Clear out the global existing run environment variable as well.\n        env.unset_variable(_RUN_ID_ENV_VAR)\n        _active_run = None\natexit.register(end_run)\n\n\ndef active_run():\n    \"\"\"Return the currently active ``Run``, or None if no such run exists.\"\"\"\n    return _active_run\n\n\ndef log_param(key, value):\n    \"\"\"\n    Log the passed-in parameter under the current run, creating a run if necessary.\n\n    :param key: Parameter name (string)\n    :param value: Parameter value (string, but will be string-ified if not)\n    \"\"\"\n    run_id = _get_or_start_run().info.run_uuid\n    get_service().log_param(run_id, key, value)\n\n\ndef set_tag(key, value):\n    \"\"\"\n    Sets the passed-in tag under the current run, creating a run if necessary.\n\n    :param key: Tag name (string)\n    :param value: Tag value (string, but will be string-ified if not)\n    \"\"\"\n    run_id = _get_or_start_run().info.run_uuid\n    get_service().set_tag(run_id, key, value)\n\n\ndef log_metric(key, value):\n    \"\"\"\n    Log the passed-in metric under the current run, creating a run if necessary.\n\n    :param key: Metric name (string).\n    :param value: Metric value (float).\n    \"\"\"\n    if not isinstance(value, numbers.Number):\n        print(\"WARNING: The metric {}={} was not logged because the value is not a number.\".format(\n            key, value), file=sys.stderr)\n        return\n    run_id = _get_or_start_run().info.run_uuid\n    get_service().log_metric(run_id, key, value, int(time.time()))\n\n\ndef log_artifact(local_path, artifact_path=None):\n    \"\"\"Log a local file or directory as an artifact of the currently active run.\"\"\"\n    artifact_uri = _get_or_start_run().info.artifact_uri\n    get_service().log_artifact(artifact_uri, local_path, artifact_path)\n\n\ndef log_artifacts(local_dir, artifact_path=None):\n    \"\"\"Log all the contents of a local directory as artifacts of the run.\"\"\"\n    artifact_uri = _get_or_start_run().info.artifact_uri\n    get_service().log_artifacts(artifact_uri, local_dir, artifact_path)\n\n\ndef create_experiment(name, artifact_location=None):\n    return get_service().create_experiment(name, artifact_location)\n\n\ndef get_artifact_uri():\n    \"\"\"\n    Return the artifact URI of the currently active run. Calls to ``log_artifact`` and\n    ``log_artifacts`` write artifact(s) to subdirectories of the returned URI.\n    \"\"\"\n    return _get_or_start_run().info.artifact_uri\n\n\ndef _get_or_start_run():\n    if _active_run:\n        return _active_run\n    return start_run()\n\n\ndef _get_main_file():\n    if len(sys.argv) > 0:\n        return sys.argv[0]\n    return None\n\n\ndef _get_source_name():\n    main_file = _get_main_file()\n    if main_file is not None:\n        return main_file\n    return \"<console>\"\n\n\ndef _get_source_version():\n    main_file = _get_main_file()\n    if main_file is not None:\n        return _get_git_commit(main_file)\n    return None\n\n\ndef _get_source_type():\n    return SourceType.LOCAL\n\n\ndef _get_experiment_id():\n    return int(env.get_env(_EXPERIMENT_ID_ENV_VAR) or Experiment.DEFAULT_EXPERIMENT_ID)\n\n\ndef _get_git_commit(path):\n    try:\n        from git import Repo, InvalidGitRepositoryError, GitCommandNotFound, NoSuchPathError\n    except ImportError as e:\n        print(\"Notice: failed to import Git (the git executable is probably not on your PATH),\"\n              \" so Git SHA is not available. Error: %s\" % e, file=sys.stderr)\n        return None\n    try:\n        if os.path.isfile(path):\n            path = os.path.dirname(path)\n        repo = Repo(path, search_parent_directories=True)\n        commit = repo.head.commit.hexsha\n        return commit\n    except (InvalidGitRepositoryError, GitCommandNotFound, ValueError, NoSuchPathError):\n        return None\n", "path": "mlflow/tracking/fluent.py"}], "after_files": [{"content": "\"\"\"\nInternal module implementing the fluent API, allowing management of an active\nMLflow run. This module is exposed to users at the top-level :py:mod:`mlflow` module.\n\"\"\"\n\nfrom __future__ import print_function\n\nimport atexit\nimport numbers\nimport os\nimport sys\nimport time\n\nfrom mlflow.entities import Experiment, Run, SourceType\nfrom mlflow.utils import env\nfrom mlflow.utils.databricks_utils import is_in_databricks_notebook, get_notebook_id, \\\n    get_notebook_path, get_webapp_url\nfrom mlflow.utils.validation import _validate_run_id\nfrom mlflow.tracking.service import get_service\n\n\n_EXPERIMENT_ID_ENV_VAR = \"MLFLOW_EXPERIMENT_ID\"\n_RUN_ID_ENV_VAR = \"MLFLOW_RUN_ID\"\n_active_run = None\n_TAG_MLFLOW_DATABRICKS_NOTEBOOK_ID = \"mlflow.databricks.notebookID\"\n_TAG_MLFLOW_DATABRICKS_NOTEBOOK_PATH = \"mlflow.databricks.notebookPath\"\n_TAG_MLFLOW_DATABRICKS_WEBAPP_URL = \"mlflow.databricks.webappURL\"\n\n\nclass ActiveRun(Run):  # pylint: disable=W0223\n    \"\"\"Wrapper around :py:class:`mlflow.entities.Run` to allow using python `with` syntax.\"\"\"\n    def __init__(self, run):\n        Run.__init__(self, run.info, run.data)\n\n    def __enter__(self):\n        return self\n\n    def __exit__(self, exc_type, exc_val, exc_tb):\n        status = \"FINISHED\" if exc_type is None else \"FAILED\"\n        end_run(status)\n        return exc_type is None\n\n\ndef start_run(run_uuid=None, experiment_id=None, source_name=None, source_version=None,\n              entry_point_name=None, source_type=None, run_name=None):\n    \"\"\"\n    Start a new MLflow run, setting it as the active run under which metrics and params\n    will be logged. The return value can be used as a context manager within a ``with`` block;\n    otherwise, ``end_run()`` must be called to terminate the current run. If ``run_uuid``\n    is passed or the ``MLFLOW_RUN_ID`` environment variable is set, ``start_run`` attempts to\n    resume a run with the specified run ID (with ``run_uuid`` taking precedence over\n    ``MLFLOW_RUN_ID``), and other parameters are ignored.\n\n    :param run_uuid: If specified, get the run with the specified UUID and log metrics\n                     and params under that run. The run's end time is unset and its status\n                     is set to running, but the run's other attributes remain unchanged\n                     (the run's ``source_version``, ``source_type``, etc. are not changed).\n    :param experiment_id: Used only when ``run_uuid`` is unspecified. ID of the experiment under\n                          which to create the current run. If unspecified, the run is created under\n                          default experiment.\n    :param source_name: Name of the source file or URI of the project to be associated with the run.\n                        Defaults to the current file if none provided.\n    :param source_version: Optional Git commit hash to associate with the run.\n    :param entry_point_name: Optional name of the entry point for to the current run.\n    :param source_type: Integer enum value describing the type of the run\n                        (\"local\", \"project\", etc.). Defaults to\n                        ``mlflow.entities.SourceType.LOCAL``.\n    :param run_name: Used only when ``run_uuid`` is unspecified. Desired name of new run created.\n    :return: :py:class:`mlflow.ActiveRun` object that acts as a context manager wrapping\n             the run's state.\n    \"\"\"\n    global _active_run\n    if _active_run:\n        raise Exception(\"Run with UUID %s is already active, unable to start nested \"\n                        \"run\" % _active_run.info.run_uuid)\n    existing_run_uuid = run_uuid or os.environ.get(_RUN_ID_ENV_VAR, None)\n    if existing_run_uuid:\n        _validate_run_id(existing_run_uuid)\n        active_run_obj = get_service().get_run(existing_run_uuid)\n    else:\n        exp_id_for_run = experiment_id or _get_experiment_id()\n        if is_in_databricks_notebook():\n            databricks_tags = {}\n            notebook_id = get_notebook_id()\n            notebook_path = get_notebook_path()\n            webapp_url = get_webapp_url()\n            if notebook_id is not None:\n                databricks_tags[_TAG_MLFLOW_DATABRICKS_NOTEBOOK_ID] = notebook_id\n            if notebook_path is not None:\n                databricks_tags[_TAG_MLFLOW_DATABRICKS_NOTEBOOK_PATH] = notebook_path\n            if webapp_url is not None:\n                databricks_tags[_TAG_MLFLOW_DATABRICKS_WEBAPP_URL] = webapp_url\n            active_run_obj = get_service().create_run(\n                experiment_id=exp_id_for_run,\n                run_name=run_name,\n                source_name=notebook_path,\n                source_version=source_version or _get_source_version(),\n                entry_point_name=entry_point_name,\n                source_type=SourceType.NOTEBOOK,\n                tags=databricks_tags)\n        else:\n            active_run_obj = get_service().create_run(\n                experiment_id=exp_id_for_run,\n                run_name=run_name,\n                source_name=source_name or _get_source_name(),\n                source_version=source_version or _get_source_version(),\n                entry_point_name=entry_point_name,\n                source_type=source_type or _get_source_type())\n    _active_run = ActiveRun(active_run_obj)\n    return _active_run\n\n\ndef end_run(status=\"FINISHED\"):\n    global _active_run\n    if _active_run:\n        get_service().set_terminated(_active_run.info.run_uuid, status)\n        # Clear out the global existing run environment variable as well.\n        env.unset_variable(_RUN_ID_ENV_VAR)\n        _active_run = None\natexit.register(end_run)\n\n\ndef active_run():\n    \"\"\"Return the currently active ``Run``, or None if no such run exists.\"\"\"\n    return _active_run\n\n\ndef log_param(key, value):\n    \"\"\"\n    Log the passed-in parameter under the current run, creating a run if necessary.\n\n    :param key: Parameter name (string)\n    :param value: Parameter value (string, but will be string-ified if not)\n    \"\"\"\n    run_id = _get_or_start_run().info.run_uuid\n    get_service().log_param(run_id, key, value)\n\n\ndef set_tag(key, value):\n    \"\"\"\n    Sets the passed-in tag under the current run, creating a run if necessary.\n\n    :param key: Tag name (string)\n    :param value: Tag value (string, but will be string-ified if not)\n    \"\"\"\n    run_id = _get_or_start_run().info.run_uuid\n    get_service().set_tag(run_id, key, value)\n\n\ndef log_metric(key, value):\n    \"\"\"\n    Log the passed-in metric under the current run, creating a run if necessary.\n\n    :param key: Metric name (string).\n    :param value: Metric value (float).\n    \"\"\"\n    if not isinstance(value, numbers.Number):\n        print(\"WARNING: The metric {}={} was not logged because the value is not a number.\".format(\n            key, value), file=sys.stderr)\n        return\n    run_id = _get_or_start_run().info.run_uuid\n    get_service().log_metric(run_id, key, value, int(time.time()))\n\n\ndef log_artifact(local_path, artifact_path=None):\n    \"\"\"Log a local file or directory as an artifact of the currently active run.\"\"\"\n    artifact_uri = _get_or_start_run().info.artifact_uri\n    get_service().log_artifact(artifact_uri, local_path, artifact_path)\n\n\ndef log_artifacts(local_dir, artifact_path=None):\n    \"\"\"Log all the contents of a local directory as artifacts of the run.\"\"\"\n    artifact_uri = _get_or_start_run().info.artifact_uri\n    get_service().log_artifacts(artifact_uri, local_dir, artifact_path)\n\n\ndef create_experiment(name, artifact_location=None):\n    return get_service().create_experiment(name, artifact_location)\n\n\ndef get_artifact_uri():\n    \"\"\"\n    Return the artifact URI of the currently active run. Calls to ``log_artifact`` and\n    ``log_artifacts`` write artifact(s) to subdirectories of the returned URI.\n    \"\"\"\n    return _get_or_start_run().info.artifact_uri\n\n\ndef _get_or_start_run():\n    if _active_run:\n        return _active_run\n    return start_run()\n\n\ndef _get_main_file():\n    if len(sys.argv) > 0:\n        return sys.argv[0]\n    return None\n\n\ndef _get_source_name():\n    main_file = _get_main_file()\n    if main_file is not None:\n        return main_file\n    return \"<console>\"\n\n\ndef _get_source_version():\n    main_file = _get_main_file()\n    if main_file is not None:\n        return _get_git_commit(main_file)\n    return None\n\n\ndef _get_source_type():\n    return SourceType.LOCAL\n\n\ndef _get_experiment_id():\n    return int(env.get_env(_EXPERIMENT_ID_ENV_VAR) or Experiment.DEFAULT_EXPERIMENT_ID)\n\n\ndef _get_git_commit(path):\n    try:\n        from git import Repo, InvalidGitRepositoryError, GitCommandNotFound, NoSuchPathError\n    except ImportError as e:\n        print(\"Notice: failed to import Git (the git executable is probably not on your PATH),\"\n              \" so Git SHA is not available. Error: %s\" % e, file=sys.stderr)\n        return None\n    try:\n        if os.path.isfile(path):\n            path = os.path.dirname(path)\n        repo = Repo(path, search_parent_directories=True)\n        commit = repo.head.commit.hexsha\n        return commit\n    except (InvalidGitRepositoryError, GitCommandNotFound, ValueError, NoSuchPathError):\n        return None\n", "path": "mlflow/tracking/fluent.py"}]}