本文整理汇总了Python中SpiffWorkflow.Workflow.complete_task_from_id方法的典型用法代码示例。如果您正苦于以下问题:Python Workflow.complete_task_from_id方法的具体用法?Python Workflow.complete_task_from_id怎么用?Python Workflow.complete_task_from_id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SpiffWorkflow.Workflow
的用法示例。
在下文中一共展示了Workflow.complete_task_from_id方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testBeginWorkflowStepByStep
# 需要导入模块: from SpiffWorkflow import Workflow [as 别名]
# 或者: from SpiffWorkflow.Workflow import complete_task_from_id [as 别名]
def testBeginWorkflowStepByStep(self):
"""
Simulates interactive calls, as would be issued by a user.
"""
xml_file = os.path.join(data_dir, 'spiff', 'workflow1.xml')
xml = open(xml_file).read()
wf_spec = WorkflowSpec.deserialize(XmlSerializer(), xml)
workflow = Workflow(wf_spec)
tasks = workflow.get_tasks(Task.READY)
self.assertEqual(len(tasks), 1)
self.assertEqual(tasks[0].task_spec.name, 'Start')
workflow.complete_task_from_id(tasks[0].id)
self.assertEqual(tasks[0].state, Task.COMPLETED)
tasks = workflow.get_tasks(Task.READY)
self.assertEqual(len(tasks), 2)
task_a1 = tasks[0]
task_b1 = tasks[1]
self.assertEqual(task_a1.task_spec.__class__, Simple)
self.assertEqual(task_a1.task_spec.name, 'task_a1')
self.assertEqual(task_b1.task_spec.__class__, Simple)
self.assertEqual(task_b1.task_spec.name, 'task_b1')
workflow.complete_task_from_id(task_a1.id)
self.assertEqual(task_a1.state, Task.COMPLETED)
tasks = workflow.get_tasks(Task.READY)
self.assertEqual(len(tasks), 2)
self.assertTrue(task_b1 in tasks)
task_a2 = tasks[0]
self.assertEqual(task_a2.task_spec.__class__, Simple)
self.assertEqual(task_a2.task_spec.name, 'task_a2')
workflow.complete_task_from_id(task_a2.id)
tasks = workflow.get_tasks(Task.READY)
self.assertEqual(len(tasks), 1)
self.assertTrue(task_b1 in tasks)
workflow.complete_task_from_id(task_b1.id)
tasks = workflow.get_tasks(Task.READY)
self.assertEqual(len(tasks), 1)
workflow.complete_task_from_id(tasks[0].id)
tasks = workflow.get_tasks(Task.READY)
self.assertEqual(len(tasks), 1)
self.assertEqual(tasks[0].task_spec.name, 'synch_1')
示例2: start_workflow
# 需要导入模块: from SpiffWorkflow import Workflow [as 别名]
# 或者: from SpiffWorkflow.Workflow import complete_task_from_id [as 别名]
def start_workflow(workflow_name):
""" start workflow for graduation project """
# create workflow instance
workflow = Workflow(workflow_specs[workflow_name])
# complete start task
start_task = workflow.get_tasks(state=Task.READY)[0]
workflow.complete_task_from_id(start_task.id)
# save username in workflow
workflow.data["student"] = g.user.username
# save workflow instance to database
save_workflow_instance(workflow, g.user.id)
return redirect(url_for('.user_page', username=g.user.username))
示例3: testBeginWorkflowStepByStep
# 需要导入模块: from SpiffWorkflow import Workflow [as 别名]
# 或者: from SpiffWorkflow.Workflow import complete_task_from_id [as 别名]
def testBeginWorkflowStepByStep(self):
"""
Simulates interactive calls, as would be issued by a user.
"""
wf_spec = self._createWorkflowSpec()
workflow = Workflow(wf_spec)
tasks = workflow.get_tasks(Task.READY)
self.assertEqual(len(tasks), 1)
self.assertEqual(tasks[0].task_spec.name, 'Start')
workflow.complete_task_from_id(tasks[0].id)
self.assertEqual(tasks[0].state, Task.COMPLETED)
tasks = workflow.get_tasks(Task.READY)
self.assertEqual(len(tasks), 2)
task_a1 = tasks[0]
task_b1 = tasks[1]
self.assertEqual(task_a1.task_spec.__class__, Simple)
self.assertEqual(task_a1.task_spec.name, 'task_a1')
self.assertEqual(task_b1.task_spec.__class__, Simple)
self.assertEqual(task_b1.task_spec.name, 'task_b1')
workflow.complete_task_from_id(task_a1.id)
self.assertEqual(task_a1.state, Task.COMPLETED)
tasks = workflow.get_tasks(Task.READY)
self.assertEqual(len(tasks), 2)
self.assertTrue(task_b1 in tasks)
task_a2 = tasks[0]
self.assertEqual(task_a2.task_spec.__class__, Simple)
self.assertEqual(task_a2.task_spec.name, 'task_a2')
workflow.complete_task_from_id(task_a2.id)
tasks = workflow.get_tasks(Task.READY)
self.assertEqual(len(tasks), 1)
self.assertTrue(task_b1 in tasks)
workflow.complete_task_from_id(task_b1.id)
tasks = workflow.get_tasks(Task.READY)
self.assertEqual(len(tasks), 1)
workflow.complete_task_from_id(tasks[0].id)
tasks = workflow.get_tasks(Task.READY)
self.assertEqual(len(tasks), 1)
self.assertEqual(tasks[0].task_spec.name, 'synch_1')
示例4: _advance_to_a1
# 需要导入模块: from SpiffWorkflow import Workflow [as 别名]
# 或者: from SpiffWorkflow.Workflow import complete_task_from_id [as 别名]
def _advance_to_a1(self, wf_spec):
workflow = Workflow(wf_spec)
tasks = workflow.get_tasks(Task.READY)
task_start = tasks[0]
workflow.complete_task_from_id(task_start.id)
tasks = workflow.get_tasks(Task.READY)
multichoice = tasks[0]
workflow.complete_task_from_id(multichoice.id)
tasks = workflow.get_tasks(Task.READY)
task_a1 = tasks[0]
workflow.complete_task_from_id(task_a1.id)
return workflow