Skip to content

Commit 04907d5

Browse files
author
Agathe Guillemot
committed
Add a DSSProjectDeployerProjectStatus#list_deployments method
1 parent 1c916e5 commit 04907d5

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

dataikuapi/dss/projectdeployer.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,8 @@ def save(self):
471471

472472

473473
class DSSProjectDeployerProjectStatus(object):
474-
"""The status of a published project.
474+
"""
475+
The status of a published project.
475476
476477
Do not create this directly, use :meth:`~dataikuapi.dss.projectdeployer.DSSProjectDeployerProject.get_status`
477478
"""
@@ -480,6 +481,20 @@ def __init__(self, client, project_key, light_status):
480481
self.project_key = project_key
481482
self.light_status = light_status
482483

484+
def list_deployments(self, infra_id=None):
485+
"""
486+
Returns the deployments that have been created from this published project
487+
488+
:param str infra_id: Identifier of an infra, allows to only keep in the returned list the deployments on this infra.
489+
If not set, the list contains all the deployments using this published project, across every infra of the Project Deployer.
490+
491+
:returns: a list of deployments
492+
:rtype: list of :class:`dataikuapi.dss.projectdeployer.DSSProjectDeployerDeployment`
493+
"""
494+
if infra_id is None:
495+
return [DSSProjectDeployerDeployment(self.client, deployment.id) for deployment in self.light_status["deployments"]]
496+
return [DSSProjectDeployerDeployment(self.client, deployment.id) for deployment in self.light_status["deployments"] if infra_id == deployment.infraId]
497+
483498
def get_bundles(self):
484499
"""
485500
Returns the bundles that have been published on this project

0 commit comments

Comments
 (0)