Skip to content

Commit 26d6d0f

Browse files
committed
API for K8S namespace policies + fix push images API
1 parent 68984f7 commit 26d6d0f

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

dataikuapi/dss/future.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ def __init__(self, client, job_id, state=None, result_wrapper=lambda result: res
1111
self.state_is_peek = True
1212
self.result_wrapper = result_wrapper
1313

14+
@staticmethod
15+
def from_resp(client, resp,result_wrapper=lambda result: result):
16+
"""Creates a DSSFuture from a parsed JSON response"""
17+
return DSSFuture(client, resp.get('jobId', None), state=resp, result_wrapper=result_wrapper)
18+
1419
@classmethod
1520
def get_result_wait_if_needed(cls, client, ret):
1621
if 'jobId' in ret:

dataikuapi/dssclient.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -917,6 +917,24 @@ def create_personal_api_key(self, label):
917917
return self._perform_json("POST", "/auth/personal-api-keys",
918918
params={"label": label})
919919

920+
########################################################
921+
# Container execution
922+
########################################################
923+
924+
def push_base_images(self):
925+
"""
926+
Push base images for Kubernetes container-execution and Spark-on-Kubernetes
927+
"""
928+
resp = self._perform_json("POST", "/admin/container-exec/actions/push-base-images")
929+
return DSSFuture.from_resp(self, resp)
930+
931+
def apply_kubernetes_namespaces_policies(self):
932+
"""
933+
Apply Kubernetes namespaces policies defined in the general settings
934+
"""
935+
resp = self._perform_json("POST", "/admin/container-exec/actions/apply-kubernetes-policies")
936+
return DSSFuture.from_resp(self, resp)
937+
920938
########################################################
921939
# Licensing
922940
########################################################

0 commit comments

Comments
 (0)