Skip to content

Commit 09c622b

Browse files
author
Valentin Thorey
committed
Move setup_mlflow to DSSProject
1 parent fd7f6f7 commit 09c622b

File tree

3 files changed

+15
-18
lines changed

3 files changed

+15
-18
lines changed

dataikuapi/dss/project.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from .analysis import DSSAnalysis
2222
from .flow import DSSProjectFlow
2323
from .app import DSSAppManifest
24+
from .dss_plugin_mlflow import MLflowHandle
2425

2526

2627
class DSSProject(object):
@@ -1595,6 +1596,18 @@ def get_app_manifest(self):
15951596
raw_data = self.client._perform_json("GET", "/projects/%s/app-manifest" % self.project_key)
15961597
return DSSAppManifest(self.client, raw_data, self.project_key)
15971598

1599+
########################################################
1600+
# MLflow
1601+
########################################################
1602+
def setup_mlflow(self, managed_folder="mlflow_artifacts", host=None):
1603+
"""
1604+
Setup the dss-plugin for MLflow
1605+
1606+
:param str managed_folder: managed folder where artifacts are stored
1607+
:param str host: setup a custom host if the backend used is not DSS
1608+
"""
1609+
return MLflowHandle(client=self.client, project_key=self.project_key, managed_folder=managed_folder, host=host)
1610+
15981611

15991612
class TablesImportDefinition(object):
16001613
"""

dataikuapi/dss_plugin_mlflow/utils.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,9 @@ def __init__(self, client, project_key, managed_folder="mlflow_artifacts", host=
3838
sys.path.insert(0, self.tempdir)
3939

4040
# Reload the artifact_repository_registry in case MLflow was imported beforehand
41-
import mlflow
42-
try: # python 3.4+
41+
if sys.version_info > (3, 4):
4342
from importlib import reload
44-
except ImportError:
45-
pass
43+
import mlflow
4644
reload(mlflow.store.artifact.artifact_repository_registry)
4745

4846
# Setup authentication

dataikuapi/dssclient.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from requests.auth import HTTPBasicAuth
66

77
from dataikuapi.dss.notebook import DSSNotebook
8-
from .dss_plugin_mlflow import MLflowHandle
98
from .dss.future import DSSFuture
109
from .dss.projectfolder import DSSProjectFolder
1110
from .dss.project import DSSProject
@@ -1088,19 +1087,6 @@ def get_object_discussions(self, project_key, object_type, object_id):
10881087
"""
10891088
return DSSObjectDiscussions(self, project_key, object_type, object_id)
10901089

1091-
########################################################
1092-
# MLflow
1093-
########################################################
1094-
def setup_mlflow(self, project_key, managed_folder="mlflow_artifacts", host=None):
1095-
"""
1096-
Setup the dss-plugin for MLflow
1097-
1098-
:param str project_key: identifier of the project to access
1099-
:param str managed_folder: managed folder where artifacts are stored
1100-
:param str host: setup a custom host if the backend used is not DSS
1101-
"""
1102-
return MLflowHandle(client=self, project_key=project_key, managed_folder=managed_folder, host=host)
1103-
11041090

11051091
class TemporaryImportHandle(object):
11061092
def __init__(self, client, import_id):

0 commit comments

Comments
 (0)