Skip to content

Commit 88f3a3f

Browse files
committed
Add scenario enabling to bundle activation [ch54172]
1 parent 1433ba6 commit 88f3a3f

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

dataikuapi/dss/project.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -921,17 +921,28 @@ def import_bundle_from_archive(self, archive_path):
921921
params = { "archivePath" : osp.abspath(archive_path) })
922922

923923
def import_bundle_from_stream(self, fp):
924-
files = {'file': fp }
924+
files = {'file': fp}
925925
return self.client._perform_empty("POST",
926926
"/projects/%s/bundles/imported/actions/importFromStream" % (self.project_key),
927927
files=files)
928928

929-
def activate_bundle(self, bundle_id):
930-
return self.client._perform_json("POST",
931-
"/projects/%s/bundles/imported/%s/actions/activate" % (self.project_key, bundle_id))
929+
def activate_bundle(self, bundle_id, scenarios_to_enable=None):
930+
"""
931+
Activates a bundle in this project.
932+
933+
:param str bundle_id: The ID of the bundle to activate
934+
:param dict scenarios_to_enable: An optional dict of scenarios to enable or disable upon bundle activation. The
935+
format of the dict should be scenario IDs as keys with values of True or False.
936+
:returns: A report containing any error or warning messages that occurred during bundle activation
937+
:rtype: dict
938+
"""
939+
options = {"scenariosActiveOnActivation": scenarios_to_enable} if scenarios_to_enable else {}
940+
941+
return self.client._perform_json("POST",
942+
"/projects/%s/bundles/imported/%s/actions/activate" % (self.project_key, bundle_id), body=options)
932943

933944
def preload_bundle(self, bundle_id):
934-
return self.client._perform_json("POST",
945+
return self.client._perform_json("POST",
935946
"/projects/%s/bundles/imported/%s/actions/preload" % (self.project_key, bundle_id))
936947

937948

0 commit comments

Comments
 (0)