在 mapreduce.yaml 上输入 Reader 字典

Input Reader dictionary on mapreduce.yaml

我一直在尝试直接从 /mapreduce 仪表板启动特定的 mapreduce,但为此我需要输入 reader 作为字典传入的参数,否则我会得到

BadReaderParamsError: Input reader parameters should be a dictionary

问题是 yaml 验证不允许我在需要的地方添加任何类型的嵌套映射。

我的 mapreduce.yaml 看起来像这样

- name: Read CSV from GCS
  mapper:
    input_reader: mapreduce.input_readers.GoogleCloudStorageLineInputReader
    handler: mapreduce.mapper
    params:
    - name: input_reader
      default: {bucket: gcs-bucket}

这只会导致我出现类似于 BadYamlError: in "<string>", line 16, column 25: default: {bucket: gcs-bucket} ^

的错误

我尝试了几种 YAML 认可的嵌套映射,但我可能错过了黄金映射 - 或者验证过于苛刻。

是否可以通过 mapreduce.yaml 传递字典,或者我必须以编程方式启动此作业?

调查此自定义输入后 reader 我在 reader_spec = _get_params(mapper_spec, allow_old=False) 上发现了 allowed_old 标志 当设置为 False 时,它需要所有输入 reader 参数成为 mapreduce.yaml

上参数 input_reader 的字典

allowed_old 设置为 True 可让您在 input_reader 参数之外列出 mapreduce.yaml 上所需的所有参数。