Skip to content

Commit 6db6131

Browse files
committed
Merge branch 'master' into feature/management-public-api-keys
2 parents 8a5a086 + 57d3916 commit 6db6131

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

dataikuapi/apinode_client.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,17 @@ def predict_records(self, endpoint_id, records, forced_generation=None, dispatch
6767

6868
return self._perform_json("POST", "%s/predict-multi" % endpoint_id, body = obj)
6969

70+
def evaluate_function(self, endpoint_id, **kwargs):
71+
"""
72+
Applies a DSS API node function endpoint (Python or R) to the given parameters
73+
74+
:param str endpoint_id: Identifier of the endpoint to query
75+
:param **kwargs: parameters to the functon
76+
77+
:return: a Python dict of the API answer. The answer is the result
78+
"""
79+
return self.apply_on_record(endpoint_id, kwargs)
80+
7081
def apply_on_record(self, endpoint_id, features):
7182
"""
7283
Applies a function on a single record on a DSS API node endpoint (Python or R function)
@@ -78,6 +89,17 @@ def apply_on_record(self, endpoint_id, features):
7889
"""
7990
return self._perform_json("POST", "%s/run" % endpoint_id, body = features)
8091

92+
def run_query(self, endpoint_id, **kwargs):
93+
"""
94+
Run a DSS API node SQL endpoint with the given parameters
95+
96+
:param str endpoint_id: Identifier of the endpoint to query
97+
:param **kwargs: parameters to the functon
98+
99+
:return: a Python dict of the API answer. The answer is the a dict with a columns field and a rows field (list of rows as list of strings)
100+
"""
101+
return self.query_on_record(endpoint_id, kwargs)
102+
81103
def query_on_record(self, endpoint_id, features):
82104
"""
83105
Run a record on a DSS API node SQL endpoint

dataikuapi/dss/project.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,10 +384,20 @@ def import_bundle_from_archive(self, archive_path):
384384
"/projects/%s/bundles/imported/actions/importFromArchive" % (self.project_key),
385385
params = { "archivePath" : osp.abspath(archive_path) })
386386

387+
def import_bundle_from_stream(self, fp):
388+
files = {'file': fp }
389+
return self.client._perform_empty("POST",
390+
"/projects/%s/bundles/imported/actions/importFromStream" % (self.project_key),
391+
files=files)
392+
387393
def activate_bundle(self, bundle_id):
388394
return self.client._perform_json("POST",
389395
"/projects/%s/bundles/imported/%s/actions/activate" % (self.project_key, bundle_id))
390396

397+
def preload_bundle(self, bundle_id):
398+
return self.client._perform_json("POST",
399+
"/projects/%s/bundles/imported/%s/actions/preload" % (self.project_key, bundle_id))
400+
391401

392402
########################################################
393403
# Scenarios

0 commit comments

Comments
 (0)