Skip to content

Commit 491a895

Browse files
committed
add creation of download recipe
1 parent 57d3916 commit 491a895

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

dataikuapi/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
from apinode_client import APINodeClient
44
from apinode_admin_client import APINodeAdminClient
55

6-
from dss.recipe import GroupingRecipeCreator, JoinRecipeCreator, StackRecipeCreator, WindowRecipeCreator, SyncRecipeCreator, SamplingRecipeCreator, SQLQueryRecipeCreator, CodeRecipeCreator, SplitRecipeCreator, SortRecipeCreator, TopNRecipeCreator, DistinctRecipeCreator
6+
from dss.recipe import GroupingRecipeCreator, JoinRecipeCreator, StackRecipeCreator, WindowRecipeCreator, SyncRecipeCreator, SamplingRecipeCreator, SQLQueryRecipeCreator, CodeRecipeCreator, SplitRecipeCreator, SortRecipeCreator, TopNRecipeCreator, DistinctRecipeCreator, DownloadRecipeCreator
77

88
from dss.admin import DSSUserImpersonationRule, DSSGroupImpersonationRule

dataikuapi/dss/recipe.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,18 +171,26 @@ def __init__(self, type, name, project):
171171
DSSRecipeCreator.__init__(self, type, name, project)
172172
self.create_output_dataset = None
173173
self.output_dataset_settings = None
174+
self.create_output_folder = None
175+
self.output_folder_settings = None
174176

175177
def with_existing_output(self, dataset_name, append=False):
176178
assert self.create_output_dataset is None
177179
self.create_output_dataset = False
178180
self._with_output(dataset_name, append)
179181
return self
180182

181-
def with_new_output(self, dataset_name, connection_id, format_option_id=None, partitioning_option_id=None, append=False):
182-
assert self.create_output_dataset is None
183-
self.create_output_dataset = True
184-
self.output_dataset_settings = {'connectionId':connection_id,'formatOptionId':format_option_id,'partitioningOptionId':partitioning_option_id}
185-
self._with_output(dataset_name, append)
183+
def with_new_output(self, name, connection_id, typeOptionId=None, format_option_id=None, partitioning_option_id=None, append=False, object_type='DATASET'):
184+
if object_type == 'DATASET':
185+
assert self.create_output_dataset is None
186+
self.create_output_dataset = True
187+
self.output_dataset_settings = {'connectionId':connection_id,'typeOptionId':typeOptionId,'formatOptionId':format_option_id,'partitioningOptionId':partitioning_option_id}
188+
self._with_output(name, append)
189+
elif object_type == 'MANAGED_FOLDER':
190+
assert self.create_output_folder is None
191+
self.create_output_folder = True
192+
self.output_folder_settings = {'connectionId':connection_id,'typeOptionId':typeOptionId,'partitioningOptionId':partitioning_option_id}
193+
self._with_output(name, append)
186194
return self
187195

188196
def with_output(self, dataset_name, append=False):
@@ -191,6 +199,8 @@ def with_output(self, dataset_name, append=False):
191199
def _finish_creation_settings(self):
192200
self.creation_settings['createOutputDataset'] = self.create_output_dataset
193201
self.creation_settings['outputDatasetSettings'] = self.output_dataset_settings
202+
self.creation_settings['createOutputFolder'] = self.create_output_folder
203+
self.creation_settings['outputFolderSettings'] = self.output_folder_settings
194204

195205
class VirtualInputsSingleOutputRecipeCreator(SingleOutputRecipeCreator):
196206
def __init__(self, type, name, project):
@@ -281,3 +291,6 @@ def __init__(self, name, project):
281291
def _finish_creation_settings(self):
282292
pass
283293

294+
class DownloadRecipeCreator(SingleOutputRecipeCreator):
295+
def __init__(self, name, project):
296+
SingleOutputRecipeCreator.__init__(self, 'download', name, project)

0 commit comments

Comments
 (0)