From 3727f4d66a477854689e65a494d0605413d1f4d9 Mon Sep 17 00:00:00 2001 From: Danny McCormick Date: Fri, 8 Mar 2024 17:55:34 -0500 Subject: [PATCH] Prefer yaml_pipeline in error messages (#30544) --- sdks/python/apache_beam/yaml/main.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/sdks/python/apache_beam/yaml/main.py b/sdks/python/apache_beam/yaml/main.py index 06173aaf60fca..5d1d3f7cea0b0 100644 --- a/sdks/python/apache_beam/yaml/main.py +++ b/sdks/python/apache_beam/yaml/main.py @@ -32,12 +32,12 @@ def _configure_parser(argv): parser = argparse.ArgumentParser() parser.add_argument( - '--pipeline_spec', '--yaml_pipeline', + '--pipeline_spec', help='A yaml description of the pipeline to run.') parser.add_argument( - '--pipeline_spec_file', '--yaml_pipeline_file', + '--pipeline_spec_file', help='A file containing a yaml description of the pipeline to run.') parser.add_argument( '--json_schema_validation', @@ -49,17 +49,17 @@ def _configure_parser(argv): def _pipeline_spec_from_args(known_args): - if known_args.pipeline_spec_file and known_args.pipeline_spec: + if known_args.yaml_pipeline_file and known_args.yaml_pipeline: raise ValueError( - "Exactly one of pipeline_spec or pipeline_spec_file must be set.") - elif known_args.pipeline_spec_file: - with FileSystems.open(known_args.pipeline_spec_file) as fin: + "Exactly one of yaml_pipeline or yaml_pipeline_file must be set.") + elif known_args.yaml_pipeline_file: + with FileSystems.open(known_args.yaml_pipeline_file) as fin: pipeline_yaml = fin.read().decode() - elif known_args.pipeline_spec: - pipeline_yaml = known_args.pipeline_spec + elif known_args.yaml_pipeline: + pipeline_yaml = known_args.yaml_pipeline else: raise ValueError( - "Exactly one of pipeline_spec or pipeline_spec_file must be set.") + "Exactly one of yaml_pipeline or yaml_pipeline_file must be set.") return pipeline_yaml