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


Python Pipeline.new_task方法代码示例

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


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

示例1: test_resource_group_get_all_mentioned_dependent_tasks

# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import new_task [as 别名]
 def test_resource_group_get_all_mentioned_dependent_tasks(self):
     p = Pipeline()
     t = p.new_task()
     t.declare_resource_group(foo={'bed': '{root}.bed', 'bim': '{root}.bim'})
     t.command(f"cat")
     t2 = p.new_task()
     t2.command(f"cat {t.foo}")
开发者ID:tpoterba,项目名称:hail,代码行数:9,代码来源:test_pipeline.py

示例2: test_resource_group_mentioned

# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import new_task [as 别名]
    def test_resource_group_mentioned(self):
        p = Pipeline()
        t = p.new_task()
        t.declare_resource_group(foo={'bed': '{root}.bed'})
        t.command(f'echo "hello" > {t.foo}')

        t2 = p.new_task()
        t2.command(f'echo "hello" >> {t.foo.bed}')
        p.run()
开发者ID:jigold,项目名称:hail,代码行数:11,代码来源:test_pipeline.py

示例3: test_resource_group_get_all_outputs

# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import new_task [as 别名]
    def test_resource_group_get_all_outputs(self):
        p = Pipeline()
        t1 = p.new_task()
        t1.declare_resource_group(foo={'bed': '{root}.bed', 'bim': '{root}.bim'})
        t1.command(f"cat {t1.foo.bed}")
        t2 = p.new_task()
        t2.command(f"cat {t1.foo.bed}")

        for r in [t1.foo.bed, t1.foo.bim]:
            assert(r in t1._outputs)
            assert(r in t2._inputs)
            assert(r in t1._mentioned)
            assert(r not in t2._mentioned)
开发者ID:jigold,项目名称:hail,代码行数:15,代码来源:test_pipeline.py

示例4: test_multiple_dependent_tasks

# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import new_task [as 别名]
    def test_multiple_dependent_tasks(self):
        with tempfile.NamedTemporaryFile('w') as output_file:
            p = Pipeline()
            t = p.new_task()
            t.command(f'echo "0" >> {t.ofile}')

            for i in range(1, 3):
                t2 = p.new_task()
                t2.command(f'echo "{i}" > {t2.tmp1}')
                t2.command(f'cat {t.ofile} {t2.tmp1} > {t2.ofile}')
                t = t2

            p.write_output(t.ofile, output_file.name)
            p.run()

            assert self.read(output_file.name) == "0\n1\n2"
开发者ID:tpoterba,项目名称:hail,代码行数:18,代码来源:test_pipeline.py

示例5: test_resource_group_get_all_mentioned

# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import new_task [as 别名]
 def test_resource_group_get_all_mentioned(self):
     p = Pipeline()
     t = p.new_task()
     t.declare_resource_group(foo={'bed': '{root}.bed', 'bim': '{root}.bim'})
     t.command(f"cat {t.foo.bed}")
     assert(t.foo.bed in t._mentioned)
     assert(t.foo.bim not in t._mentioned)
开发者ID:tpoterba,项目名称:hail,代码行数:9,代码来源:test_pipeline.py

示例6: test_resource_group_get_all_inputs

# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import new_task [as 别名]
 def test_resource_group_get_all_inputs(self):
     p = Pipeline()
     input = p.read_input_group(fasta="foo",
                                idx="bar")
     t = p.new_task()
     t.command(f"cat {input.fasta}")
     assert(input.fasta in t._inputs)
     assert(input.idx in t._inputs)
开发者ID:tpoterba,项目名称:hail,代码行数:10,代码来源:test_pipeline.py

示例7: test_scatter_gather

# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import new_task [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'
开发者ID:tpoterba,项目名称:hail,代码行数:20,代码来源:test_pipeline.py

示例8: test_single_task

# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import new_task [as 别名]
    def test_single_task(self):
        with tempfile.NamedTemporaryFile('w') as output_file:
            msg = 'hello world'

            p = Pipeline()
            t = p.new_task()
            t.command(f'echo "{msg}" > {t.ofile}')
            p.write_output(t.ofile, output_file.name)
            p.run()

            assert self.read(output_file.name) ==  msg
开发者ID:tpoterba,项目名称:hail,代码行数:13,代码来源:test_pipeline.py

示例9: test_declare_resource_group

# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import new_task [as 别名]
    def test_declare_resource_group(self):
        with tempfile.NamedTemporaryFile('w') as output_file:
            msg = 'hello world'
            p = Pipeline()
            t = p.new_task()
            t.declare_resource_group(ofile={'log': "{root}.txt"})
            t.command(f'echo "{msg}" > {t.ofile.log}')
            p.write_output(t.ofile.log, output_file.name)
            p.run()

            assert self.read(output_file.name) == msg
开发者ID:tpoterba,项目名称:hail,代码行数:13,代码来源:test_pipeline.py

示例10: test_single_task_w_input

# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import new_task [as 别名]
    def test_single_task_w_input(self):
        with tempfile.NamedTemporaryFile('w') as input_file, \
                tempfile.NamedTemporaryFile('w') as output_file:
            msg = 'abc'
            input_file.write(msg)
            input_file.flush()

            p = Pipeline()
            input = p.read_input(input_file.name)
            t = p.new_task()
            t.command(f'cat {input} > {t.ofile}')
            p.write_output(t.ofile, output_file.name)
            p.run()

            assert self.read(output_file.name) == msg
开发者ID:tpoterba,项目名称:hail,代码行数:17,代码来源:test_pipeline.py

示例11: test_file_name_space

# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import new_task [as 别名]
    def test_file_name_space(self):
        with tempfile.NamedTemporaryFile('w', prefix="some file name with (foo) spaces") as input_file, \
                tempfile.NamedTemporaryFile('w', prefix="another file name with (foo) spaces") as output_file:

            input_file.write('abc')
            input_file.flush()

            p = Pipeline()
            input = p.read_input(input_file.name)
            t = p.new_task()
            t.command(f'cat {input} > {t.ofile}')
            p.write_output(t.ofile, output_file.name)
            p.run()

            self.assert_same_file(input_file.name, output_file.name)
开发者ID:jigold,项目名称:hail,代码行数:17,代码来源:test_pipeline.py

示例12: test_multiple_isolated_tasks

# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import new_task [as 别名]
    def test_multiple_isolated_tasks(self):
        p = Pipeline()

        output_files = []
        try:
            output_files = [tempfile.NamedTemporaryFile('w') for i in range(5)]

            for i, ofile in enumerate(output_files):
                msg = f'hello world {i}'
                t = p.new_task()
                t.command(f'echo "{msg}" > {t.ofile}')
                p.write_output(t.ofile, ofile.name)
            p.run()

            for i, ofile in enumerate(output_files):
                msg = f'hello world {i}'
                assert self.read(ofile.name) == msg
        finally:
            [ofile.close() for ofile in output_files]
开发者ID:tpoterba,项目名称:hail,代码行数:21,代码来源:test_pipeline.py

示例13: test_single_task_w_input_group

# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import new_task [as 别名]
    def test_single_task_w_input_group(self):
        with tempfile.NamedTemporaryFile('w') as input_file1, \
                tempfile.NamedTemporaryFile('w') as input_file2, \
                tempfile.NamedTemporaryFile('w') as output_file:
            msg1 = 'abc'
            msg2 = '123'

            input_file1.write(msg1)
            input_file2.write(msg2)
            input_file1.flush()
            input_file2.flush()

            p = Pipeline()
            input = p.read_input_group(in1=input_file1.name,
                                       in2=input_file2.name)
            t = p.new_task()
            t.command(f'cat {input.in1} {input.in2} > {t.ofile}')
            p.write_output(t.ofile, output_file.name)
            p.run()

            assert self.read(output_file.name) == msg1 + msg2
开发者ID:tpoterba,项目名称:hail,代码行数:23,代码来源:test_pipeline.py

示例14: test_add_extension_task_resource_file

# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import new_task [as 别名]
 def test_add_extension_task_resource_file(self):
     p = Pipeline()
     t = p.new_task()
     t.command(f'echo "hello" > {t.ofile}')
     t.ofile.add_extension('.txt.bgz')
     assert t.ofile._value.endswith('.txt.bgz')
开发者ID:tpoterba,项目名称:hail,代码行数:8,代码来源:test_pipeline.py

示例15: test_select_tasks

# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import new_task [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)
开发者ID:tpoterba,项目名称:hail,代码行数:7,代码来源:test_pipeline.py


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