Repository: Lightning-AI/pytorch-lightning
Pull request: MLFlow now uses env variable as default tracking uri
## What does this PR do?
It changes the initialization of MLFlowLogger so that it uses the environment variable MLFLOW_TRACKING_URI by default

Fixes #6894

Problem statement:
MLFlowLogger should defaults to enironment variable MLFLOW_TRACKING_URI
## 🚀 Feature
The default value of `tracking_uri` in the initializer of `MLFlowLogger` should be `MLFLOW_TRACKING_URI` environment variable if set.

### Motivation
1. `mlflow` works in this way
2. it allows to have one tracking server with multiple processes using it (otherwise processes conflicts)

Hints from issue discussion:
This issue has been automatically marked as stale because it hasn't had any recent activity. This issue will be closed in 7 days if no further activity occurs. Thank you for your contributions, Pytorch Lightning Team!

Thanks for the issue @00sapo! feel free to send a PR.

Commit message: MLFlow now uses env variable as default tracking uri

Solves https://github.com/PyTorchLightning/pytorch-lightning/issues/6894

Patch to review:
diff --git a/pytorch_lightning/loggers/mlflow.py b/pytorch_lightning/loggers/mlflow.py
index 516ed55de9fcf..a3e42b551e887 100644
--- a/pytorch_lightning/loggers/mlflow.py
+++ b/pytorch_lightning/loggers/mlflow.py
@@ -16,6 +16,7 @@
 -------------
 """
 import logging
+import os
 import re
 from argparse import Namespace
 from time import time
@@ -85,7 +86,8 @@ def any_lightning_module_function_or_hook(self):
     Args:
         experiment_name: The name of the experiment
         tracking_uri: Address of local or remote tracking server.
-            If not provided, defaults to `file:<save_dir>`.
+            If not provided, defaults to `MLFLOW_TRACKING_URI` environment variable if set, otherwise it falls
+            back to `file:<save_dir>`.
         tags: A dictionary tags for the experiment.
         save_dir: A path to a local directory where the MLflow runs get saved.
             Defaults to `./mlflow` if `tracking_uri` is not provided.
@@ -104,7 +106,7 @@ def any_lightning_module_function_or_hook(self):
     def __init__(
         self,
         experiment_name: str = 'default',
-        tracking_uri: Optional[str] = None,
+        tracking_uri: Optional[str] = os.environ.get('MLFLOW_TRACKING_URI'),,
         tags: Optional[Dict[str, Any]] = None,
         save_dir: Optional[str] = './mlruns',
         prefix: str = '',


Code review comments:
diff_hunk: @@ -104,7 +106,7 @@ def any_lightning_module_function_or_hook(self):
     def __init__(
         self,
         experiment_name: str = 'default',
-        tracking_uri: Optional[str] = None,
+        tracking_uri: Optional[str] = os.environ.get('MLFLOW_TRACKING_URI'),,
path: pytorch_lightning/loggers/mlflow.py
text: @user1:
```suggestion
        tracking_uri: Optional[str] = os.getenv('MLFLOW_TRACKING_URI'),
```