Skip to content

Commit 08c1c9a

Browse files
committed
PR feedback
1 parent ca504ed commit 08c1c9a

File tree

4 files changed

+25
-40
lines changed

4 files changed

+25
-40
lines changed

dataikuapi/dss/admin.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1514,15 +1514,6 @@ def name(self):
15141514
def id(self):
15151515
return self._data["id"]
15161516
@property
1517-
def type(self):
1518-
return self._data["type"]
1519-
@property
1520-
def type_label(self):
1521-
return self._data.get("desc", {}).get("label", self._data["type"])
1522-
@property
1523-
def type_description(self):
1524-
return self._data.get("desc", {}).get("description", self._data["type"])
1525-
@property
15261517
def build_for_configs(self):
15271518
return self._data.get("buildFor", [])
15281519
@property

dataikuapi/dss/codestudio.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ def delete(self):
5151

5252
def get_settings(self):
5353
"""
54-
Get the code studio object's settings
54+
Get the code studio object's definition
5555
56-
:returns: a handle to manage the code studio settings
56+
:returns: a handle to manage the code studio definition
5757
:rtype: :class:`dataikuapi.dss.codestudio.DSSCodeStudioObjectSettings`
5858
"""
5959
settings = self.client._perform_json("GET", "/projects/%s/code-studios/%s" % (self.project_key, self.code_studio_object_id))
@@ -77,10 +77,7 @@ def stop(self):
7777
:rtype: :class:`dataikuapi.dss.future.DSSFuture`
7878
"""
7979
ret = self.client._perform_json("POST", "/projects/%s/code-studios/%s/stop" % (self.project_key, self.code_studio_object_id))
80-
if 'jobId' in ret:
81-
return self.client.get_future(ret["jobId"])
82-
else:
83-
return None
80+
return DSSFuture.from_resp(self.client, ret)
8481

8582
def restart(self):
8683
"""
@@ -90,10 +87,7 @@ def restart(self):
9087
:rtype: :class:`dataikuapi.dss.future.DSSFuture`
9188
"""
9289
ret = self.client._perform_json("POST", "/projects/%s/code-studios/%s/restart" % (self.project_key, self.code_studio_object_id))
93-
if 'jobId' in ret:
94-
return self.client.get_future(ret["jobId"])
95-
else:
96-
return None
90+
return DSSFuture.from_resp(self.client, ret)
9791

9892
class DSSCodeStudioObjectSettings(object):
9993
"""
@@ -112,6 +106,14 @@ def get_raw(self):
112106
"""
113107
return self.settings
114108

109+
@property
110+
def template_id(self):
111+
return self.settings["templateId"]
112+
@property
113+
def lib_name(self):
114+
return self.settings["libName"]
115+
116+
115117
class DSSCodeStudioObjectStatus(object):
116118
"""
117119
Status of a code studio object
@@ -133,7 +135,7 @@ def get_raw(self):
133135
def state(self):
134136
return self.status["state"]
135137
@property
136-
def last_built(self):
138+
def last_state_change(self):
137139
ts = self.status.get("lastStateChange", 0)
138140
if ts > 0:
139141
return datetime.fromtimestamp(ts / 1000)

dataikuapi/dss/project.py

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1634,12 +1634,11 @@ def get_mlflow_extension(self):
16341634
########################################################
16351635
# Code studios
16361636
########################################################
1637-
def list_code_studio_objects(self, as_type="listitems"):
1637+
def list_code_studios(self, as_type="listitems"):
16381638
"""
16391639
List the code studio objects in this project
16401640
1641-
Returns:
1642-
the list of the code studio objects, each one as a JSON object
1641+
:returns: the list of the code studio objects, each one as a JSON object
16431642
"""
16441643
items = self.client._perform_json(
16451644
"GET", "/projects/%s/code-studios/" % self.project_key)
@@ -1650,28 +1649,24 @@ def list_code_studio_objects(self, as_type="listitems"):
16501649
else:
16511650
raise ValueError("Unknown as_type")
16521651

1653-
def get_code_studio_object(self, code_studio_object_id):
1652+
def get_code_studio(self, code_studio_object_id):
16541653
"""
16551654
Get a handle to interact with a specific code studio object
16561655
1657-
Args:
1658-
code_studio_object_id: the identifier of the desired code studio object
1656+
:param str code_studio_object_id: the identifier of the desired code studio object
16591657
1660-
Returns:
1661-
A :class:`dataikuapi.dss.codestudio.DSSCodeStudioObject` code studio object handle
1658+
:returns: A :class:`dataikuapi.dss.codestudio.DSSCodeStudioObject` code studio object handle
16621659
"""
16631660
return DSSCodeStudioObject(self.client, self.project_key, code_studio_object_id)
16641661

1665-
def create_code_studio_object(self, name, template_id):
1662+
def create_code_studio(self, name, template_id):
16661663
"""
16671664
Create a new code studio object in the project, and return a handle to interact with it
16681665
1669-
Args:
1670-
name: the name of the code studio object
1671-
template_id: the identifier of a code studio template
1666+
:param str name: the name of the code studio object
1667+
:param str template_id: the identifier of a code studio template
16721668
1673-
Returns:
1674-
A :class:`dataikuapi.dss.codestudio.DSSCodeStudioObject` code studio object handle
1669+
:returns: A :class:`dataikuapi.dss.codestudio.DSSCodeStudioObject` code studio object handle
16751670
"""
16761671
obj = {
16771672
"name" : name,

dataikuapi/dssclient.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -627,8 +627,7 @@ def list_code_studio_templates(self, as_type='listitems'):
627627
"""
628628
List all code studio templates on the DSS instance
629629
630-
Returns:
631-
List of templates (name, type)
630+
:returns: List of templates (name, type)
632631
"""
633632
items = self._perform_json("GET", "/admin/code-studios/")
634633
if as_type == "listitems" or as_type == "listitem":
@@ -642,11 +641,9 @@ def get_code_studio_template(self, template_id):
642641
"""
643642
Get a handle to interact with a specific code studio template
644643
645-
Args:
646-
template_id: the template id of the desired code studio template
644+
:param str template_id: the template id of the desired code studio template
647645
648-
Returns:
649-
A :class:`dataikuapi.dss.admin.DSSCodeStudioTemplate` code studio template handle
646+
:returns: A :class:`dataikuapi.dss.admin.DSSCodeStudioTemplate` code studio template handle
650647
"""
651648
return DSSCodeStudioTemplate(self, template_id)
652649

0 commit comments

Comments
 (0)