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


Python Task.spawned_tasks方法代码示例

本文整理汇总了Python中pulp.bindings.responses.Task.spawned_tasks方法的典型用法代码示例。如果您正苦于以下问题:Python Task.spawned_tasks方法的具体用法?Python Task.spawned_tasks怎么用?Python Task.spawned_tasks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pulp.bindings.responses.Task的用法示例。


在下文中一共展示了Task.spawned_tasks方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_poll_additional_spawned_tasks_list

# 需要导入模块: from pulp.bindings.responses import Task [as 别名]
# 或者: from pulp.bindings.responses.Task import spawned_tasks [as 别名]
    def test_poll_additional_spawned_tasks_list(self):
        """
        Test polling over a list where a task has spawned additional tasks that need to be
        added to the polling list

        Task Count: 3
        Statuses: None; normal progression
        Result: All Success
        """

        # Setup
        sim = TaskSimulator()
        sim.install(self.bindings)

        states_1 = [STATE_WAITING, STATE_RUNNING, STATE_FINISHED]
        states_2 = [STATE_WAITING, STATE_WAITING, STATE_RUNNING, STATE_FINISHED]
        states_3 = [STATE_WAITING, STATE_RUNNING, STATE_RUNNING, STATE_RUNNING, STATE_FINISHED]

        task_1_states = sim.add_task_states('1', states_1)
        sim.add_task_states('2', states_2)
        sim.add_task_states('3', states_3)

        container_task = Task({})
        task_list = sim.get_all_tasks().response_body
        task_1_states[2].spawned_tasks = task_list[1:]
        # Test
        container_task.spawned_tasks = sim.get_all_tasks().response_body
        completed_tasks = self.command.poll(task_list[:1], {})

        expected_tags = ['abort', # default, always displayed
                         # states_1
                         'delayed-spinner', 'running-spinner', 'succeeded',
                         # states_2
                         'header', 'delayed-spinner', 'running-spinner', 'running-spinner',
                         'succeeded',
                         # states_3
                         'header', 'delayed-spinner', 'running-spinner', 'running-spinner',
                         'running-spinner',  'succeeded',
                         ]
        found_tags = self.prompt.get_write_tags()
        self.assertEqual(expected_tags, found_tags)

        self.assertTrue(isinstance(completed_tasks, list))
        self.assertEqual(3, len(completed_tasks))
        for i in range(0, 3):
            self.assertEqual(STATE_FINISHED, completed_tasks[i].state)
开发者ID:preethit,项目名称:pulp-1,代码行数:48,代码来源:test_polling.py

示例2: test_poll_spawned_tasks_list

# 需要导入模块: from pulp.bindings.responses import Task [as 别名]
# 或者: from pulp.bindings.responses.Task import spawned_tasks [as 别名]
    def test_poll_spawned_tasks_list(self):
        """
        Test the structure where a command has both synchronous and asynchronous sections
        and returns a task structure with a result and a spawned_tasks list

        Task Count: 3
        Statuses: None; normal progression
        Result: All Success
        """

        # Setup
        sim = TaskSimulator()
        sim.install(self.bindings)

        states_1 = [STATE_WAITING, STATE_RUNNING, STATE_FINISHED]
        states_2 = [STATE_WAITING, STATE_WAITING, STATE_RUNNING, STATE_FINISHED]
        states_3 = [STATE_WAITING, STATE_RUNNING, STATE_RUNNING, STATE_RUNNING, STATE_FINISHED]

        sim.add_task_states('1', states_1)
        sim.add_task_states('2', states_2)
        sim.add_task_states('3', states_3)

        container_task = Task({})

        # Test
        container_task.spawned_tasks = sim.get_all_tasks().response_body
        completed_tasks = self.command.poll(container_task, {})

        expected_tags = ['abort', # default, always displayed
                         # states_1
                         'header', 'delayed-spinner', 'running-spinner', 'running-spinner', 'succeeded',
                         # states_2
                         'header', 'delayed-spinner', 'delayed-spinner', 'running-spinner', 'running-spinner',
                         'succeeded',
                         # states_3
                         'header', 'delayed-spinner', 'running-spinner', 'running-spinner',
                         'running-spinner', 'running-spinner', 'succeeded',
                         ]
        found_tags = self.prompt.get_write_tags()
        self.assertEqual(expected_tags, found_tags)

        self.assertTrue(isinstance(completed_tasks, list))
        self.assertEqual(3, len(completed_tasks))
        for i in range(0, 3):
            self.assertEqual(STATE_FINISHED, completed_tasks[i].state)
开发者ID:preethit,项目名称:pulp-1,代码行数:47,代码来源:test_polling.py


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