本文整理汇总了Python中pipeline.Pipeline.select_tasks方法的典型用法代码示例。如果您正苦于以下问题:Python Pipeline.select_tasks方法的具体用法?Python Pipeline.select_tasks怎么用?Python Pipeline.select_tasks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pipeline.Pipeline
的用法示例。
在下文中一共展示了Pipeline.select_tasks方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_scatter_gather
# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import select_tasks [as 别名]
def test_scatter_gather(self):
with tempfile.NamedTemporaryFile('w') as output_file:
p = Pipeline()
for i in range(3):
t = p.new_task().label(f'foo{i}')
t.command(f'echo "{i}" > {t.ofile}')
merger = p.new_task()
merger.command('cat {files} > {ofile}'.format(files=' '.join([t.ofile for t in sorted(p.select_tasks('foo'),
key=lambda x: x._label,
reverse=True)]),
ofile=merger.ofile))
p.write_output(merger.ofile, output_file.name)
p.run()
assert self.read(output_file.name) == '2\n1\n0'
示例2: test_select_tasks
# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import select_tasks [as 别名]
def test_select_tasks(self):
p = Pipeline()
for i in range(3):
t = p.new_task().label(f'foo{i}')
self.assertTrue(len(p.select_tasks('foo')) == 3)