当前位置: 首页>>代码示例>>Python>>正文


Python Workflow.complete_task_from_id方法代码示例

本文整理汇总了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')
开发者ID:0-T-0,项目名称:SpiffWorkflow,代码行数:48,代码来源:WorkflowTest.py

示例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))
开发者ID:coskundeniz,项目名称:bitirme-projesi,代码行数:19,代码来源:views.py

示例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')
开发者ID:filipefigcorreia,项目名称:SpiffWorkflow,代码行数:46,代码来源:WorkflowTest.py

示例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
开发者ID:0-T-0,项目名称:SpiffWorkflow,代码行数:17,代码来源:PersistSmallWorkflowTest.py


注:本文中的SpiffWorkflow.Workflow.complete_task_from_id方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。