I'm trying to write a custom template to read a CSV and output it to another CSV. The objective is to select the desired data in this CSV. When I run it on the web interface I have the following error
I have reduced the code as much as possible to understand my error but I still don't see it. I helped myself to the documentation : https://cloud.google.com/dataflow/docs/guides/templates/creating-templates#creating-and-staging-templates
class UploadOptions(PipelineOptions):
@classmethod
def _add_argparse_args(cls, parser):
parser.add_value_provider_argument(
'--input',
default='gs://[MYBUCKET]/input.csv',
help='Path of the file to read from')
parser.add_value_provider_argument(
'--output',
required=True,
help='Output file to write results to.')
pipeline_options = PipelineOptions(['--output', 'gs://[MYBUCKET]/output'])
p = beam.Pipeline(options=pipeline_options)
upload_options = pipeline_options.view_as(UploadOptions)
(p
| 'read' >> beam.io.Read(upload_options.input)
| 'Write' >> beam.io.WriteToText(upload_options.output, file_name_suffix='.csv'))
The current error is as follows
Unable to parse file 'gs://MYBUCKET/template.py'.
In the terminal I have the following error
ERROR: (gcloud.dataflow.jobs.run) FAILED_PRECONDITION: Unable to parse template file 'gs://[MYBUCKET]/template.py'. - '@type': type.googleapis.com/google.rpc.PreconditionFailure violations: - description: "Unexpected end of stream : expected '{'" subject: 0:0 type: JSON
Thank you in advance