You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by da...@apache.org on 2024/03/06 16:31:36 UTC

(beam) 01/01: Prefer yaml_pipeline in error messages

This is an automated email from the ASF dual-hosted git repository.

damccorm pushed a commit to branch users/damccorm/yaml_pipeline
in repository https://gitbox.apache.org/repos/asf/beam.git

commit 8d71007d7c8f8d0d134967a4f40b6722436fdb86
Author: Danny McCormick <da...@google.com>
AuthorDate: Wed Mar 6 11:31:29 2024 -0500

    Prefer yaml_pipeline in error messages
---
 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 06173aaf60f..5d1d3f7cea0 100644
--- a/sdks/python/apache_beam/yaml/main.py
+++ b/sdks/python/apache_beam/yaml/main.py
@@ -32,12 +32,12 @@ LogicalType.register_logical_type(MillisInstant)
 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