Skip to content

Commit af42fd6

Browse files
committed
ability to select project folder in which to put the projecg created in automation node
1 parent 1058fdd commit af42fd6

1 file changed

Lines changed: 16 additions & 6 deletions

File tree

dataikuapi/dssclient.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -678,27 +678,37 @@ def get_general_settings(self):
678678
# Bundles / Import (Automation node)
679679
########################################################
680680

681-
def create_project_from_bundle_local_archive(self, archive_path):
681+
def create_project_from_bundle_local_archive(self, archive_path, project_folder=None):
682682
"""
683683
Create a project from a bundle archive.
684684
Warning: this method can only be used on an automation node.
685685
686686
:param string archive_path: Path on the local machine where the archive is
687+
:param project_folder: the project folder in which the project will be created or None for root project folder
688+
:type project_folder: A :class:`dataikuapi.dss.projectfolder.DSSProjectFolder`
687689
"""
688-
return self._perform_json("POST",
689-
"/projectsFromBundle/fromArchive",
690-
params = { "archivePath" : osp.abspath(archive_path) })
690+
params = {
691+
"archivePath" : osp.abspath(archive_path)
692+
}
693+
if project_folder is not None:
694+
params["projectFolderId"] = project_folder.project_folder_id
695+
return self._perform_json("POST", "/projectsFromBundle/fromArchive", params=params)
691696

692-
def create_project_from_bundle_archive(self, fp):
697+
def create_project_from_bundle_archive(self, fp, project_folder=None):
693698
"""
694699
Create a project from a bundle archive (as a file object)
695700
Warning: this method can only be used on an automation node.
696701
697702
:param string fp: A file-like object pointing to a bundle archive zip
703+
:param project_folder: the project folder in which the project will be created or None for root project folder
704+
:type project_folder: A :class:`dataikuapi.dss.projectfolder.DSSProjectFolder`
698705
"""
706+
params = {}
707+
if project_folder is not None:
708+
params['projectFolderId'] = project_folder.project_folder_id
699709
files = {'file': fp }
700710
return self._perform_json("POST",
701-
"/projectsFromBundle/", files=files)
711+
"/projectsFromBundle/", files=files, params=params)
702712

703713
def prepare_project_import(self, f):
704714
"""

0 commit comments

Comments
 (0)