本文整理汇总了Python中doit.control.TaskControl._add_task方法的典型用法代码示例。如果您正苦于以下问题:Python TaskControl._add_task方法的具体用法?Python TaskControl._add_task怎么用?Python TaskControl._add_task使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类doit.control.TaskControl
的用法示例。
在下文中一共展示了TaskControl._add_task方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testChangeOrder_AddJustOnce
# 需要导入模块: from doit.control import TaskControl [as 别名]
# 或者: from doit.control.TaskControl import _add_task [as 别名]
def testChangeOrder_AddJustOnce(self):
tasks = [Task("taskX",None,task_dep=["taskY"]),
Task("taskY",None,)]
tc = TaskControl(tasks)
tc.process(None)
assert [tasks[1], tasks[0]] == [x for x in tc._add_task(0, 'taskX', False)]
# both tasks were already added. so no tasks left..
assert [] == [x for x in tc._add_task(0, 'taskY', False)]
示例2: testParallel
# 需要导入模块: from doit.control import TaskControl [as 别名]
# 或者: from doit.control.TaskControl import _add_task [as 别名]
def testParallel(self):
tasks = [Task("taskX",None,task_dep=["taskY"]),
Task("taskY",None)]
tc = TaskControl(tasks)
tc.process(None)
gen1 = tc._add_task(0, "taskX", False)
assert tasks[1] == gen1.next()
# gen2 wont get any task, because it was already being processed
gen2 = tc._add_task(1, "taskY", False)
py.test.raises(StopIteration, gen2.next)
示例3: testDetectCyclicReference
# 需要导入模块: from doit.control import TaskControl [as 别名]
# 或者: from doit.control.TaskControl import _add_task [as 别名]
def testDetectCyclicReference(self):
tasks = [Task("taskX",None,task_dep=["taskY"]),
Task("taskY",None,task_dep=["taskX"])]
tc = TaskControl(tasks)
tc.process(None)
gen = tc._add_task(0, "taskX", False)
py.test.raises(InvalidDodoFile, gen.next)
示例4: testSetupInvalid
# 需要导入模块: from doit.control import TaskControl [as 别名]
# 或者: from doit.control.TaskControl import _add_task [as 别名]
def testSetupInvalid(self):
tasks = [Task("taskX",None,setup=["taskZZZZZZZZ"]),
Task("taskY",None,)]
tc = TaskControl(tasks)
tc.process(['taskX'])
gen = tc._add_task(0, 'taskX', False)
assert tasks[0] == gen.next() # tasks with setup are yield twice
tasks[0].run_status = 'run' # should be executed
py.test.raises(InvalidTask, gen.next) # execute setup before
示例5: testSetupTasksDontRun
# 需要导入模块: from doit.control import TaskControl [as 别名]
# 或者: from doit.control.TaskControl import _add_task [as 别名]
def testSetupTasksDontRun(self):
tasks = [Task("taskX",None,setup=["taskY"]),
Task("taskY",None,)]
tc = TaskControl(tasks)
tc.process(['taskX'])
gen = tc._add_task(0, 'taskX', False)
assert tasks[0] == gen.next()
# X is up-to-date
tasks[0].run_status = 'up-to-date'
py.test.raises(StopIteration, gen.next)
示例6: testSetupTasksRun
# 需要导入模块: from doit.control import TaskControl [as 别名]
# 或者: from doit.control.TaskControl import _add_task [as 别名]
def testSetupTasksRun(self):
tasks = [Task("taskX",None,setup=["taskY"]),
Task("taskY",None,)]
tc = TaskControl(tasks)
tc.process(['taskX'])
gen = tc._add_task(0, 'taskX', False)
assert tasks[0] == gen.next() # tasks with setup are yield twice
tasks[0].run_status = 'run' # should be executed
assert tasks[1] == gen.next() # execute setup before
assert tasks[0] == gen.next() # second time, ok
py.test.raises(StopIteration, gen.next) # nothing left
示例7: testIncludeSetup
# 需要导入模块: from doit.control import TaskControl [as 别名]
# 或者: from doit.control.TaskControl import _add_task [as 别名]
def testIncludeSetup(self):
# with include_setup yield all tasks without waiting for setup tasks to
# be ready
tasks = [Task("taskX",None,setup=["taskY"]),
Task("taskY",None,)]
tc = TaskControl(tasks)
tc.process(['taskX'])
gen = tc._add_task(0, 'taskX', True) # <== include_setup
assert tasks[0] == gen.next() # tasks with setup are yield twice
assert tasks[1] == gen.next() # execute setup before
assert tasks[0] == gen.next() # second time, ok
py.test.raises(StopIteration, gen.next) # nothing left
示例8: testCalcDep
# 需要导入模块: from doit.control import TaskControl [as 别名]
# 或者: from doit.control.TaskControl import _add_task [as 别名]
def testCalcDep(self):
def get_deps():
print "gget"
return {'file_dep': ('a', 'b')}
tasks = [Task("taskX", None, calc_dep=['task_dep']),
Task("task_dep", [(get_deps,)]),
]
tc = TaskControl(tasks)
tc.process(['taskX'])
gen = tc._add_task(0, 'taskX', False)
assert tasks[1] == gen.next()
assert isinstance(gen.next(), WaitRunTask)
tasks[1].execute()
assert tasks[0] == gen.next()
assert set(['a', 'b']) == tasks[0].file_dep
示例9: testWaitSetup
# 需要导入模块: from doit.control import TaskControl [as 别名]
# 或者: from doit.control.TaskControl import _add_task [as 别名]
def testWaitSetup(self):
tasks = [Task("taskX",None,setup=["taskY"]),
Task("taskY",None,)]
tc = TaskControl(tasks)
tc.process(['taskX'])
gen = tc._add_task(0, 'taskX', False)
assert tasks[0] == gen.next() # tasks with setup are yield twice
# wait for taskX run_status
wait = gen.next()
assert wait.task_name == 'taskX'
assert isinstance(wait, WaitSelectTask)
tasks[0].run_status = 'run' # should be executed
assert tasks[1] == gen.next() # execute setup before
assert tasks[0] == gen.next() # second time, ok
py.test.raises(StopIteration, gen.next) # nothing left
示例10: testAddNotSelected
# 需要导入模块: from doit.control import TaskControl [as 别名]
# 或者: from doit.control.TaskControl import _add_task [as 别名]
def testAddNotSelected(self):
tasks = [Task("taskX",None,task_dep=["taskY"]),
Task("taskY",None,)]
tc = TaskControl(tasks)
tc.process(['taskX'])
assert [tasks[1], tasks[0]] == [x for x in tc._add_task(0, 'taskX',False)]