Skip to content

Commit

Permalink
[yaml] support gcs location for main.py yaml input file (#29014)
Browse files Browse the repository at this point in the history
  • Loading branch information
Polber authored Oct 20, 2023
1 parent 96acc2c commit 97a52af
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sdks/python/apache_beam/yaml/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit 97a52af

Please sign in to comment.