本文整理汇总了Python中sevenbridges.meta.transformer.Transform.to_app方法的典型用法代码示例。如果您正苦于以下问题:Python Transform.to_app方法的具体用法?Python Transform.to_app怎么用?Python Transform.to_app使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sevenbridges.meta.transformer.Transform
的用法示例。
在下文中一共展示了Transform.to_app方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create
# 需要导入模块: from sevenbridges.meta.transformer import Transform [as 别名]
# 或者: from sevenbridges.meta.transformer.Transform import to_app [as 别名]
def create(cls, name, project, app, batch_input=None, batch_by=None,
inputs=None,
description=None, run=False, api=None):
"""
Creates a task on server.
:param name: Task name.
:param project: Project identifier.
:param app: CWL app identifier.
:param batch_input: Batch input.
:param batch_by: Batch criteria.
:param inputs: Input map.
:param description: Task description.
:param run: True if you want to run a task upon creation.
:param api: Api instance.
:return: Task object.
"""
task_data = {}
project = Transform.to_project(project)
app = Transform.to_app(app)
task_inputs = {'inputs': {}}
for k, v in inputs.items():
if isinstance(v, File):
input = {
'class': 'File',
'path': v.id,
}
task_inputs['inputs'][k] = input
elif isinstance(v, list):
input_list = []
for inp in v:
if isinstance(inp, File):
input = {
'class': 'File',
'path': inp.id,
}
if inp.name:
input['name'] = inp.name
input_list.append(input)
else:
input_list.append(inp)
task_inputs['inputs'][k] = input_list
else:
task_inputs['inputs'][k] = v
if batch_input:
task_data['batch_input'] = batch_input
if batch_by:
task_data['batch_by'] = batch_by
task_meta = {
'name': name,
'project': project,
'app': app,
'description': description
}
task_data.update(task_meta)
task_data.update(task_inputs)
params = {'action': 'run'} if run else {}
api = api if api else cls._API
created_task = api.post(cls._URL['query'], data=task_data,
params=params).json()
return Task(api=api, **created_task)
示例2: test_transform_app
# 需要导入模块: from sevenbridges.meta.transformer import Transform [as 别名]
# 或者: from sevenbridges.meta.transformer.Transform import to_app [as 别名]
def test_transform_app(app):
Transform.to_app(app)