Skip to content

Commit fcaf895

Browse files
authored
Add move_to_zone function to the DSSRecipe object
Add move_to_zone function to the DSSRecipe
2 parents 0165dd0 + eb1e1a9 commit fcaf895

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

dataikuapi/dss/recipe.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
from .discussion import DSSObjectDiscussions
44
import json, logging, warnings
55
from .utils import DSSTaggableObjectListItem, DSSTaggableObjectSettings
6+
try:
7+
basestring
8+
except NameError:
9+
basestring = str
610

711
class DSSRecipeListItem(DSSTaggableObjectListItem):
812
"""An item in a list of recipes. Do not instantiate this class, use :meth:`dataikuapi.dss.project.DSSProject.list_recipes`"""
@@ -34,6 +38,11 @@ def __init__(self, client, project_key, recipe_name):
3438
self.project_key = project_key
3539
self.recipe_name = recipe_name
3640

41+
@property
42+
def id(self):
43+
"""The id of the recipe"""
44+
return self.recipe_name
45+
3746
@property
3847
def name(self):
3948
"""The name of the recipe"""
@@ -225,6 +234,16 @@ def get_continuous_activity(self):
225234
from .continuousactivity import DSSContinuousActivity
226235
return DSSContinuousActivity(self.client, self.project_key, self.recipe_name)
227236

237+
def move_to_zone(self, zone):
238+
"""
239+
Moves this object to a flow zone
240+
241+
:param object zone: a :class:`dataikuapi.dss.flow.DSSFlowZone` where to move the object
242+
"""
243+
if isinstance(zone, basestring):
244+
zone = self.client.get_project(self.project_key).get_flow().get_zone(zone)
245+
zone.add_item(self)
246+
228247
class DSSRecipeStatus(object):
229248
"""Status of a recipce.
230249
Do not create that directly, use :meth:`DSSRecipe.get_status`"""

0 commit comments

Comments
 (0)