本文整理汇总了Python中apache_beam.pipeline.Pipeline.from_runner_api方法的典型用法代码示例。如果您正苦于以下问题:Python Pipeline.from_runner_api方法的具体用法?Python Pipeline.from_runner_api怎么用?Python Pipeline.from_runner_api使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类apache_beam.pipeline.Pipeline
的用法示例。
在下文中一共展示了Pipeline.from_runner_api方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from apache_beam.pipeline import Pipeline [as 别名]
# 或者: from apache_beam.pipeline.Pipeline import from_runner_api [as 别名]
def run(self, request, context):
job_id = uuid.uuid4().get_hex()
pipeline_result = Pipeline.from_runner_api(
request.pipeline,
'DirectRunner',
PipelineOptions()).run()
self.jobs[job_id] = pipeline_result
return beam_job_api_pb2.SubmitJobResponse(jobId=job_id)
示例2: test_simple
# 需要导入模块: from apache_beam.pipeline import Pipeline [as 别名]
# 或者: from apache_beam.pipeline.Pipeline import from_runner_api [as 别名]
def test_simple(self):
"""Tests serializing, deserializing, and running a simple pipeline.
More extensive tests are done at pipeline.run for each suitable test.
"""
p = beam.Pipeline()
p | beam.Create([None]) | beam.Map(lambda x: x) # pylint: disable=expression-not-assigned
proto = p.to_runner_api()
p2 = Pipeline.from_runner_api(proto, p.runner, p._options)
p2.run()
示例3: test_parent_pointer
# 需要导入模块: from apache_beam.pipeline import Pipeline [as 别名]
# 或者: from apache_beam.pipeline.Pipeline import from_runner_api [as 别名]
def test_parent_pointer(self):
class MyPTransform(beam.PTransform):
def expand(self, p):
self.p = p
return p | beam.Create([None])
p = beam.Pipeline()
p | MyPTransform() # pylint: disable=expression-not-assigned
p = Pipeline.from_runner_api(Pipeline.to_runner_api(p), None, None)
self.assertIsNotNone(p.transforms_stack[0].parts[0].parent)
self.assertEquals(p.transforms_stack[0].parts[0].parent,
p.transforms_stack[0])