本文整理汇总了Python中task.Task.create方法的典型用法代码示例。如果您正苦于以下问题:Python Task.create方法的具体用法?Python Task.create怎么用?Python Task.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类task.Task
的用法示例。
在下文中一共展示了Task.create方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: menu
# 需要导入模块: from task import Task [as 别名]
# 或者: from task.Task import create [as 别名]
def menu(arguments):
if arguments['list']:
if arguments['--recursive']:
task_lineage(arguments)
else:
task_list(arguments)
else:
try:
if arguments['create']:
Task.create(**_task_create_kwargs(arguments))
elif arguments['read']:
task_read(arguments)
elif arguments['set']:
task_set(arguments)
elif arguments['delete']:
Task(arguments['<name>']).delete()
elif arguments['reset']:
task_reset(arguments)
except NameError as exc:
print(PACKAGE_NAME, 'Error!', exc)
sys.exit(1)
示例2: post
# 需要导入模块: from task import Task [as 别名]
# 或者: from task.Task import create [as 别名]
def post(self):
data = json.loads(self.request.body)
if 'id' in data:
task = Task.get_by_id(data['id'])
task.update(data)
self.response.write(str(data['id']))
else:
key = Task.create(data, User.getCurrentUserKey())
self.response.write(str(key.id()))
示例3: add_task
# 需要导入模块: from task import Task [as 别名]
# 或者: from task.Task import create [as 别名]
def add_task(self, data, parent=None):
task = Task.create(data)
task.project_id = self._id
if parent:
task.parent_id = parent.obj.get_id()
task.index_as_child = parent.child_count()
task.set_path(parent.obj.path)
else:
task.parent_id = self._id
task.set_path('')
task.save()
return task
示例4: _test_task
# 需要导入模块: from task import Task [as 别名]
# 或者: from task.Task import create [as 别名]
def _test_task(my):
print "test task"
# create a dummy sobject
sobject = SearchType.create("unittest/person")
pipeline_xml = '''
<pipeline>
<process name="a"/>
<process type="action" name="b"/>
<connect from="a" to="b"/>
</pipeline>
'''
pipeline, processes = my.get_pipeline(pipeline_xml)
sobject.set_value("pipeline_code", pipeline.get_code() )
sobject.commit()
for process_name, process in processes.items():
process.set_json_value("workflow", {
#'on_in_progress': '''
#sobject.set_value('name_first', '%s')
#''' % process_name,
'on_complete': '''
sobject.set_value('name_first', '%s')
''' % process_name,
} )
process.commit()
task = Task.create(sobject, process="a", description="Test Task")
# TODO: not quite sure if this should be related to "action"
#task.set_value("status", "in_progress")
#task.commit()
#my.assertEquals( "in_progress", sobject.get_value("name_first"))
task.set_value("status", "complete")
task.commit()
my.assertEquals( "b", sobject.get_value("name_first"))