本文整理汇总了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)
示例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)