Skip to content

Commit 3f4b9f4

Browse files
committed
gh dss integration added ignore warning flag and added get governance status endpoint
1 parent 36ea10f commit 3f4b9f4

1 file changed

Lines changed: 17 additions & 3 deletions

File tree

dataikuapi/dss/apideployer.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def get_deployment(self, deployment_id):
3636
"""
3737
return DSSAPIDeployerDeployment(self.client, deployment_id)
3838

39-
def create_deployment(self, deployment_id, service_id, infra_id, version):
39+
def create_deployment(self, deployment_id, service_id, infra_id, version, ignore_warnings=False):
4040
"""
4141
Creates a deployment and returns the handle to interact with it. The returned deployment
4242
is not yet started and you need to call :meth:`~DSSAPIDeployerDeployment.start_update`
@@ -45,6 +45,7 @@ def create_deployment(self, deployment_id, service_id, infra_id, version):
4545
:param str service_id: Identifier of the API Service to target
4646
:param str infra_id: Identifier of the deployment infrastructure to use
4747
:param str version_id: Identifier of the API Service version to deploy
48+
:param boolean ignore_warnings: ignore warnings concerning the governance status of the model version(s) to deploy
4849
:rtype: :class:`DSSAPIDeployerDeployment`
4950
"""
5051
settings = {
@@ -53,7 +54,7 @@ def create_deployment(self, deployment_id, service_id, infra_id, version):
5354
"infraId" : infra_id,
5455
"version" : version
5556
}
56-
self.client._perform_json("POST", "/api-deployer/deployments", body=settings)
57+
self.client._perform_json("POST", "/api-deployer/deployments", params={"ignoreWarnings": ignore_warnings}, body=settings)
5758
return self.get_deployment(deployment_id)
5859

5960
def list_stages(self):
@@ -310,6 +311,16 @@ def get_status(self):
310311

311312
return DSSAPIDeployerDeploymentStatus(self.client, self.deployment_id, light, heavy)
312313

314+
def get_governance_status(self, version=""):
315+
"""
316+
Returns the governance status about this deployment if applicable
317+
It covers all the embedded model versions
318+
319+
:param str version: (Optional) The specific package version of the published service to get status from. If empty, consider all the versions used in the deployment generation mapping.
320+
:rtype: dict InforMessages containing the governance status
321+
"""
322+
return self.client._perform_json("POST", "/api-deployer/deployments/%s/governance-status" % (self.deployment_id), params={ "version": version })
323+
313324
def get_settings(self):
314325
"""
315326
Gets the settings of this deployment. If you want to modify the settings, you need to
@@ -383,12 +394,15 @@ def set_single_version(self, version):
383394
"generation": version
384395
}
385396

386-
def save(self):
397+
def save(self, ignore_warnings=False):
387398
"""
388399
Saves back these settings to the deployment
400+
401+
:param boolean ignore_warnings: ignore warnings concerning the governance status of the model version(s) to deploy
389402
"""
390403
self.client._perform_empty(
391404
"PUT", "/api-deployer/deployments/%s/settings" % (self.deployment_id),
405+
params = { "ignoreWarnings" : ignore_warnings },
392406
body = self.settings)
393407

394408

0 commit comments

Comments
 (0)