-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #191: added support to export nested runs for Databricks MLflow…
… only
- Loading branch information
amesar
committed
Jul 20, 2024
1 parent
302e303
commit 1da3aa4
Showing
3 changed files
with
76 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from mlflow_export_import.common import utils | ||
from mlflow_export_import.common.iterators import SearchRunsIterator | ||
|
||
_logger = utils.getLogger(__name__) | ||
|
||
|
||
def get_nested_runs(client, runs): | ||
""" | ||
Return set of run_ids and their nested run descendants from list of run IDs. | ||
""" | ||
if utils.calling_databricks(): | ||
return get_by_rootRunId(client, runs) | ||
else: | ||
_logger.warning(f"OSS MLflow nested run export not yet supported") | ||
return runs | ||
|
||
|
||
def get_by_rootRunId(client, runs): | ||
""" | ||
Return list of nested run descendants (includes the root run). | ||
Unlike Databricks MLflow, OSS MLflow does not add the 'mlflow.rootRunId' tag to child runs. | ||
""" | ||
descendant_runs= [] | ||
for run in runs: | ||
filter = f"tags.mlflow.rootRunId = '{run.info.run_id}'" | ||
descendant_runs += list(SearchRunsIterator(client, run.info.experiment_id, filter=filter)) | ||
return descendant_runs |