Skip to content

Commit 5aaeee0

Browse files
committed
add call to save app manifest
1 parent e78a697 commit 5aaeee0

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

dataikuapi/dss/app.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,17 @@ def get_instance(self, instance_key):
7777

7878
def get_manifest(self):
7979
raw_data = self.client._perform_json("GET", "/apps/%s/" % self.app_id)
80-
return DSSAppManifest(self.client, raw_data)
80+
project_key = self.app_id[8:] if self.app_id.startswith('PROJECT_') else None
81+
return DSSAppManifest(self.client, raw_data, project_key)
8182

8283

8384
class DSSAppManifest(object):
8485

85-
def __init__(self, client, raw_data):
86+
def __init__(self, client, raw_data, project_key=None):
8687
"""The manifest for an app. Do not create this class directly"""
8788
self.client = client
8889
self.raw_data = raw_data
90+
self.project_key = project_key
8991

9092
def get_raw(self):
9193
return self.raw_data
@@ -97,6 +99,13 @@ def get_runnable_scenarios(self):
9799
"""Return the scenario identifiers that are declared as actions for this app"""
98100
return [x["scenarioId"] for x in self.get_all_actions() if x["type"] == "SCENARIO_RUN"]
99101

102+
def save(self):
103+
"""Saves the changes to this manifest object back to the template project"""
104+
if self.project_key is None:
105+
raise Exception("This manifest object wasn't created from a project, cannot be saved back")
106+
self.client._perform_empty("PUT", "/projects/%s/app-manifest" % self.project_key, body=self.raw_data)
107+
108+
100109
class DSSAppInstance(object):
101110

102111
def __init__(self, client, project_key):

dataikuapi/dss/project.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1111,7 +1111,7 @@ def to_schema_table_pair(x):
11111111

11121112
def get_app_manifest(self):
11131113
raw_data = self.client._perform_json("GET", "/projects/%s/app-manifest" % self.project_key)
1114-
return DSSAppManifest(self.client, raw_data)
1114+
return DSSAppManifest(self.client, raw_data, self.project_key)
11151115

11161116

11171117
class TablesImportDefinition(object):

0 commit comments

Comments
 (0)