本文整理汇总了Python中apache_beam.test_pipeline.TestPipeline.get_option方法的典型用法代码示例。如果您正苦于以下问题:Python TestPipeline.get_option方法的具体用法?Python TestPipeline.get_option怎么用?Python TestPipeline.get_option使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类apache_beam.test_pipeline.TestPipeline
的用法示例。
在下文中一共展示了TestPipeline.get_option方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_wordcount_it
# 需要导入模块: from apache_beam.test_pipeline import TestPipeline [as 别名]
# 或者: from apache_beam.test_pipeline.TestPipeline import get_option [as 别名]
def test_wordcount_it(self):
test_pipeline = TestPipeline(is_integration_test=True)
# Set extra options to the pipeline for test purpose
output = '/'.join([test_pipeline.get_option('output'),
test_pipeline.get_option('job_name'),
'results'])
pipeline_verifiers = [PipelineStateMatcher(),
FileChecksumMatcher(output + '*-of-*',
self.DEFAULT_CHECKSUM)]
extra_opts = {'output': output,
'on_success_matcher': all_of(*pipeline_verifiers)}
# Get pipeline options from command argument: --test-pipeline-options,
# and start pipeline job by calling pipeline main function.
wordcount.run(test_pipeline.get_full_options_as_args(**extra_opts))
示例2: test_bigquery_tornadoes_it
# 需要导入模块: from apache_beam.test_pipeline import TestPipeline [as 别名]
# 或者: from apache_beam.test_pipeline.TestPipeline import get_option [as 别名]
def test_bigquery_tornadoes_it(self):
test_pipeline = TestPipeline(is_integration_test=True)
# Set extra options to the pipeline for test purpose
output_table = ('BigQueryTornadoesIT'
'.monthly_tornadoes_%s' % int(round(time.time() * 1000)))
query = 'SELECT month, tornado_count FROM [%s]' % output_table
pipeline_verifiers = [PipelineStateMatcher(),
BigqueryMatcher(
project=test_pipeline.get_option('project'),
query=query,
checksum=self.DEFAULT_CHECKSUM)]
extra_opts = {'output': output_table,
'on_success_matcher': all_of(*pipeline_verifiers)}
# Get pipeline options from command argument: --test-pipeline-options,
# and start pipeline job by calling pipeline main function.
bigquery_tornadoes.run(
test_pipeline.get_full_options_as_args(**extra_opts))
示例3: test_get_option
# 需要导入模块: from apache_beam.test_pipeline import TestPipeline [as 别名]
# 或者: from apache_beam.test_pipeline.TestPipeline import get_option [as 别名]
def test_get_option(self):
name, value = ('job', 'mockJob')
test_pipeline = TestPipeline()
test_pipeline.options_list = ['--%s=%s' % (name, value)]
self.assertEqual(test_pipeline.get_option(name), value)