本文整理汇总了Python中radical.entk.Task.parent_stage['uid']方法的典型用法代码示例。如果您正苦于以下问题:Python Task.parent_stage['uid']方法的具体用法?Python Task.parent_stage['uid']怎么用?Python Task.parent_stage['uid']使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类radical.entk.Task
的用法示例。
在下文中一共展示了Task.parent_stage['uid']方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_task_from_cu
# 需要导入模块: from radical.entk import Task [as 别名]
# 或者: from radical.entk.Task import parent_stage['uid'] [as 别名]
def create_task_from_cu(cu, prof=None):
"""
Purpose: Create a Task based on the Compute Unit.
Details: Currently, only the uid, parent_stage and parent_pipeline are retrieved. The exact initial Task (that was
converted to a CUD) cannot be recovered as the RP API does not provide the same attributes for a CU as for a CUD.
Also, this is not required for the most part.
TODO: Add exit code, stdout, stderr and path attributes to a Task. These can be extracted from a CU
:arguments:
:cu: RP Compute Unit
:return: Task
"""
try:
logger.debug('Create Task from CU %s' % cu.name)
if prof:
prof.prof('task from cu - create',
uid=cu.name.split(',')[0].strip())
task = Task()
task.uid = cu.name.split(',')[0].strip()
task.name = cu.name.split(',')[1].strip()
task.parent_stage['uid'] = cu.name.split(',')[2].strip()
task.parent_stage['name'] = cu.name.split(',')[3].strip()
task.parent_pipeline['uid'] = cu.name.split(',')[4].strip()
task.parent_pipeline['name'] = cu.name.split(',')[5].strip()
task.rts_uid = cu.uid
if cu.state == rp.DONE:
task.exit_code = 0
else:
task.exit_code = 1
task.path = ru.Url(cu.sandbox).path
if prof:
prof.prof('task from cu - done', uid=cu.name.split(',')[0].strip())
logger.debug('Task %s created from CU %s' % (task.uid, cu.name))
return task
except Exception, ex:
logger.exception('Task creation from CU failed, error: %s' % ex)
raise