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


Python Pipeline.write_output方法代码示例

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


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

示例1: test_declare_resource_group

# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import write_output [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

示例2: test_single_task

# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import write_output [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

示例3: test_read_input_and_write_output

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

            p = Pipeline()
            input = p.read_input(input_file.name)
            p.write_output(input, output_file.name)
            p.run()

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

示例4: test_write_resource_group

# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import write_output [as 别名]
    def test_write_resource_group(self):
        with tempfile.NamedTemporaryFile('w') as input_file1, \
                tempfile.NamedTemporaryFile('w') as input_file2, \
                tempfile.TemporaryDirectory() as output_dir:

            p = Pipeline()
            input = p.read_input_group(in1=input_file1.name,
                                       in2=input_file2.name)

            p.write_output(input, output_dir + '/foo')
            p.run()

            self.assert_same_file(input_file1.name, output_dir + '/foo.in1')
            self.assert_same_file(input_file2.name, output_dir + '/foo.in2')
开发者ID:jigold,项目名称:hail,代码行数:16,代码来源:test_pipeline.py

示例5: test_single_task_w_input

# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import write_output [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

示例6: test_file_name_space

# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import write_output [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

示例7: test_multiple_dependent_tasks

# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import write_output [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

示例8: test_scatter_gather

# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import write_output [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

示例9: test_multiple_isolated_tasks

# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import write_output [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

示例10: test_single_task_w_input_group

# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import write_output [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

示例11: test_read_input_group

# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import write_output [as 别名]
    def test_read_input_group(self):
        with tempfile.NamedTemporaryFile('w') as input_file1, \
                tempfile.NamedTemporaryFile('w') as input_file2, \
                tempfile.NamedTemporaryFile('w') as output_file1, \
                tempfile.NamedTemporaryFile('w') as output_file2:

            input_file1.write('abc')
            input_file2.write('123')
            input_file1.flush()
            input_file2.flush()

            p = Pipeline()
            input = p.read_input_group(in1=input_file1.name,
                                       in2=input_file2.name)

            p.write_output(input.in1, output_file1.name)
            p.write_output(input.in2, output_file2.name)
            p.run()

            self.assert_same_file(input_file1.name, output_file1.name)
            self.assert_same_file(input_file2.name, output_file2.name)
开发者ID:tpoterba,项目名称:hail,代码行数:23,代码来源:test_pipeline.py


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