本文整理汇总了Python中Task.Task.outputs方法的典型用法代码示例。如果您正苦于以下问题:Python Task.outputs方法的具体用法?Python Task.outputs怎么用?Python Task.outputs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Task.Task
的用法示例。
在下文中一共展示了Task.outputs方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __run__
# 需要导入模块: from Task import Task [as 别名]
# 或者: from Task.Task import outputs [as 别名]
#.........这里部分代码省略.........
sys.stderr.write( traceback.format_exc() )
sys.stderr.write( '\n' )
sys.stderr.flush()
continue
# report
if self.verbose: print '%s: Got task' % name; sys.stdout.flush()
# --------------------------------------------------------------
# Execute Task
# --------------------------------------------------------------
try:
# check task object type
if not isinstance(this_task,Task):
#raise Exception, 'Task must be of type VyPy.Task'
this_task = Task(this_task,self.function)
# unpack task
this_input = this_task.inputs
this_function = this_task.function or self.function
this_owner = this_task.owner
this_folder = this_task.folder
# --------------------------------------------------------------
# Check for kill signal
# --------------------------------------------------------------
if isinstance(this_input,KillTask.__class__):
break
# report
if self.verbose: print '%s: Inputs = %s, Operation = %s' % (name,this_input,self.function); sys.stdout.flush()
# --------------------------------------------------------------
# Call Task Function
# --------------------------------------------------------------
# in the folder it was created
with redirect.folder(this_folder):
# report
if self.verbose: print os.getcwd(); sys.stdout.flush()
# the function call!
this_output = self.__func__(this_input,this_function)
# report
if self.verbose: print '%s: Task complete' % name; sys.stdout.flush()
# make sure we get std's
sys.stdout.flush()
sys.stderr.flush()
# --------------------------------------------------------------
# Task Exception Catching
# --------------------------------------------------------------
# system exits
except (KeyboardInterrupt, SystemExit):
raise
# all other exceptions
except Exception as exc:
trace_str = traceback.format_exc()
if self.verbose:
sys.stderr.write( '%s: Task Failed \n' % name )
sys.stderr.write( trace_str )
sys.stderr.write( '\n' )
sys.stderr.flush()
exc.args = (trace_str,)
this_output = exc
#: end try task
# --------------------------------------------------------------
# Wrap Up Task
# --------------------------------------------------------------
# store output
this_task.outputs = this_output
# pick outbox
this_outbox = this_task.outbox or self.outbox
# avoid serialization error with managed outboxes
this_task.outbox = None
# put task
if this_outbox: this_outbox.put(this_task)
# end joinable inbox task
self.inbox.task_done()
#: end while alive
# --------------------------------------------------------------
# End of Process
# --------------------------------------------------------------
# end joinable inbox task
self.inbox.task_done()
# report
if self.verbose: print '%s: Ending' % name; sys.stdout.flush()
return