From 97a52af980d521cfbeba1c3f272942cf39d555f1 Mon Sep 17 00:00:00 2001 From: Jeff Kinard <35542536+Polber@users.noreply.github.com> Date: Fri, 20 Oct 2023 19:08:58 -0400 Subject: [PATCH] [yaml] support gcs location for main.py yaml input file (#29014) --- sdks/python/apache_beam/yaml/main.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sdks/python/apache_beam/yaml/main.py b/sdks/python/apache_beam/yaml/main.py index e2ec8df9cfc3..331b9e7b3616 100644 --- a/sdks/python/apache_beam/yaml/main.py +++ b/sdks/python/apache_beam/yaml/main.py @@ -20,6 +20,7 @@ import yaml import apache_beam as beam +from apache_beam.io.filesystems import FileSystems from apache_beam.typehints.schemas import LogicalType from apache_beam.typehints.schemas import MillisInstant from apache_beam.yaml import yaml_transform @@ -43,8 +44,8 @@ def _pipeline_spec_from_args(known_args): raise ValueError( "Exactly one of pipeline_spec or pipeline_spec_file must be set.") elif known_args.pipeline_spec_file: - with open(known_args.pipeline_spec_file) as fin: - pipeline_yaml = fin.read() + with FileSystems.open(known_args.pipeline_spec_file) as fin: + pipeline_yaml = fin.read().decode() elif known_args.pipeline_spec: pipeline_yaml = known_args.pipeline_spec else: