本文整理汇总了Python中apache.thermos.config.schema.Task.finalization_wait方法的典型用法代码示例。如果您正苦于以下问题:Python Task.finalization_wait方法的具体用法?Python Task.finalization_wait怎么用?Python Task.finalization_wait使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类apache.thermos.config.schema.Task
的用法示例。
在下文中一共展示了Task.finalization_wait方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_combine_tasks
# 需要导入模块: from apache.thermos.config.schema import Task [as 别名]
# 或者: from apache.thermos.config.schema.Task import finalization_wait [as 别名]
def test_combine_tasks():
p1 = Process(name='p1')
p2 = Process(name='p2')
p3 = Process(name='p3')
p4 = Process(name='p4')
r100 = Resources(cpu=1, ram=0, disk=0)
r010 = Resources(cpu=0, ram=1, disk=0)
r001 = Resources(cpu=0, ram=0, disk=1)
r111 = Units.resources_sum(r100, r010, r001)
t1 = Task(name="p1p2", processes=[p1, p2], constraints=order(p1, p2),
resources=Units.resources_sum(r100, r010), finalization_wait=60)
t2 = Task(name="p3p4", processes=[p3, p4], constraints=order(p3, p4),
resources=r001, finalization_wait=45)
assert combine_tasks() == Task()
assert combine_tasks(t1) == t1
assert combine_tasks(t2) == t2
t3 = combine_tasks(t1, t2)
assert t3.name() == t2.name()
assert t3.resources() == r111
assert set(t3.processes()) == set([p1, p2, p3, p4])
assert set(t3.constraints()) == set(order(p1, p2) + order(p3, p4))
assert t3.finalization_wait().get() == t1.finalization_wait().get()
t4 = concat_tasks(t1, t2)
assert t4.name() == t2.name()
assert t4.resources() == r111
assert set(t4.processes()) == set([p1, p2, p3, p4])
assert set(t4.constraints()) == set(
order(p1, p2) + order(p3, p4) + order(p1, p3) + order(p1, p4) +
order(p2, p3) + order(p2, p4))
assert t4.finalization_wait().get() == t1.finalization_wait().get() + t2.finalization_wait().get()