本文整理汇总了Python中girder_client.GirderClient.createFolder方法的典型用法代码示例。如果您正苦于以下问题:Python GirderClient.createFolder方法的具体用法?Python GirderClient.createFolder怎么用?Python GirderClient.createFolder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类girder_client.GirderClient
的用法示例。
在下文中一共展示了GirderClient.createFolder方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: BaseIntegrationTest
# 需要导入模块: from girder_client import GirderClient [as 别名]
# 或者: from girder_client.GirderClient import createFolder [as 别名]
class BaseIntegrationTest(unittest.TestCase):
def __init__(self, name, girder_url, girder_user, girder_password, job_timeout=60, cleanup=True):
super(BaseIntegrationTest, self).__init__(name)
self._job_id = None
self._script_id = None
self._output_folder_id = None
self._input_folder_id = None
self._girder_url = girder_url
self._girder_user = girder_user
self._girder_password = girder_password
self._job_timeout = job_timeout
self._data = 'Need more input!'
self._cleanup = cleanup
def setUp(self):
url = '%s/api/v1' % self._girder_url
self._client = GirderClient(apiUrl=url)
self._client.authenticate(self._girder_user,
self._girder_password)
user = self._client.get('user/me')
self._user_id = user['_id']
r = list(self._client.listFolder(self._user_id, 'user', name='Private'))
self.assertEqual(len(r), 1)
self._private_folder_id = r[0]['_id']
def tearDown(self):
if not self._cleanup:
return
if self._job_id:
try:
url = 'jobs/%s' % self._job_id
self._client.delete(url)
except Exception as e:
traceback.print_exc()
if self._script_id:
try:
url = 'scripts/%s' % self._script_id
self._client.delete(url)
except Exception:
traceback.print_exc()
if self._output_folder_id:
try:
url = 'folder/%s' % self._output_folder_id
self._client.delete(url)
except Exception:
traceback.print_exc()
if self._input_folder_id:
try:
url = 'folder/%s' % self._input_folder_id
self._client.delete(url)
except Exception:
traceback.print_exc()
def create_script(self, commands=[
'sleep 10', 'cat CumulusIntegrationTestInput'
]):
body = {
'commands': commands,
'name': 'CumulusIntegrationTestLob'
}
r = self._client.post('scripts', data=json.dumps(body))
self._script_id = r['_id']
def create_input(self, folder_name='CumulusInput'):
r = self._client.createFolder(self._private_folder_id, folder_name)
self._input_folder_id = r['_id']
size = len(self._data)
item = self._client.uploadFile(self._input_folder_id,
StringIO(self._data), 'CumulusIntegrationTestInput', size,
parentType='folder')
self._item_id = item['itemId']
def create_output_folder(self, folder_name='CumulusOutput'):
r = self._client.createFolder(self._private_folder_id, folder_name)
self._output_folder_id = r['_id']
def create_job(self, job_name='CumulusIntegrationTestJob', tail=None):
body = {
'name': job_name,
'scriptId': self._script_id,
'output': [{
'folderId': self._output_folder_id,
'path': '.'
}],
'input': [
{
'folderId': self._input_folder_id,
'path': '.'
}
]
#.........这里部分代码省略.........