【发布时间】:2020-12-21 09:53:00
【问题描述】:
我有云功能,可以在加载新文件时启动数据流模板并将 GS 上的路由传递给该文件。我必须将其作为价值提供者阅读并像这样在管道中传递它。
class DataFlowOptions(PipelineOptions):
@classmethod
def _add_argparse_args(cls, parser):
parser.add_value_provider_argument('--input')
dataflow_options = PipelineOptions().view_as(DataFlowOptions)
pipeline = apache_beam.Pipeline(options = dataflow_options)
(pipeline
| fileio.MatchFiles(dataflow_options.input)
| fileio.ReadMatches()
| apache_beam.FlatMap(lambda f: csv.DictReader(io.TextIOWrapper(f.open())))
# ...
)
但模板启动时出现此错误:AttributeError("'RuntimeValueProvider' object has no attribute 'strip'")
我该如何解决这个问题?
【问题讨论】:
标签: google-cloud-platform google-cloud-dataflow apache-beam