Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixing mlflow logging to Databricks workspace file paths with /Shared/ prefix #3410

Merged
merged 6 commits into from
Jun 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions composer/loggers/mlflow_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,12 @@ def __init__(
)
assert self.experiment_name is not None # type hint

if os.getenv('DATABRICKS_TOKEN') is not None and not self.experiment_name.startswith('/Users/'):
if os.getenv(
'DATABRICKS_TOKEN',
) is not None and not self.experiment_name.startswith((
'/Users/',
'/Shared/',
)):
try:
from databricks.sdk import WorkspaceClient
except ImportError as e:
Expand All @@ -160,7 +165,7 @@ def __init__(
conda_channel='conda-forge',
) from e
databricks_username = WorkspaceClient().current_user.me().user_name or ''
self.experiment_name = '/' + os.path.join('Users', databricks_username, self.experiment_name)
self.experiment_name = os.path.join('/Users', databricks_username, self.experiment_name.strip('/'))

self._mlflow_client = MlflowClient(self.tracking_uri)
# Set experiment
Expand Down
Loading