From 65550a71f961f8783b41f287b88798e657ec7745 Mon Sep 17 00:00:00 2001 From: Jeff Kinard Date: Thu, 15 Aug 2024 19:21:58 -0400 Subject: [PATCH] [yaml] Doc improvements (#32117) * [yaml] explicitly define beam imports for callables in docs Signed-off-by: Jeffrey Kinard * [yaml] add windowing time suffix in docs Signed-off-by: Jeffrey Kinard * [yaml] update gcloud yaml run command to use non-beta Signed-off-by: Jeffrey Kinard * [yaml] fix sql combine to align with doc example Signed-off-by: Jeffrey Kinard * remove import beam from yaml docs Signed-off-by: Jeffrey Kinard --------- Signed-off-by: Jeffrey Kinard --- sdks/python/apache_beam/yaml/yaml_combine.py | 2 +- .../www/site/content/en/documentation/sdks/yaml-combine.md | 6 +++--- .../content/en/documentation/sdks/yaml-inline-python.md | 2 -- website/www/site/content/en/documentation/sdks/yaml.md | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/sdks/python/apache_beam/yaml/yaml_combine.py b/sdks/python/apache_beam/yaml/yaml_combine.py index 4d2193c82249..a28bef52ea31 100644 --- a/sdks/python/apache_beam/yaml/yaml_combine.py +++ b/sdks/python/apache_beam/yaml/yaml_combine.py @@ -70,7 +70,7 @@ def normalize_combine(spec): def normalize_agg(dest, agg): if isinstance(agg, str): agg = {'fn': agg} - if 'value' not in agg and spec.get('language') != 'sql': + if 'value' not in agg and config.get('language') != 'sql': agg['value'] = dest if isinstance(agg['fn'], str): agg['fn'] = {'type': agg['fn']} diff --git a/website/www/site/content/en/documentation/sdks/yaml-combine.md b/website/www/site/content/en/documentation/sdks/yaml-combine.md index b49d9b079f77..dadeee8879a7 100644 --- a/website/www/site/content/en/documentation/sdks/yaml-combine.md +++ b/website/www/site/content/en/documentation/sdks/yaml-combine.md @@ -63,7 +63,7 @@ field name col2: sum ``` -One can aggregate over may fields at once +One can aggregate over many fields at once ``` - type: Combine @@ -103,7 +103,7 @@ As with all transforms, `Combine` can take a windowing parameter - type: Combine windowing: type: fixed - size: 60 + size: 60s config: group_by: col1 combine: @@ -118,7 +118,7 @@ parameters from upstream, e.g. - type: WindowInto windowing: type: fixed - size: 60 + size: 60s - type: Combine config: group_by: col1 diff --git a/website/www/site/content/en/documentation/sdks/yaml-inline-python.md b/website/www/site/content/en/documentation/sdks/yaml-inline-python.md index fff43cf54788..e951711022f7 100644 --- a/website/www/site/content/en/documentation/sdks/yaml-inline-python.md +++ b/website/www/site/content/en/documentation/sdks/yaml-inline-python.md @@ -103,8 +103,6 @@ is interpreted as the Python code. For example constructor: __constructor__ kwargs: source: | - import apache_beam as beam - def create_my_transform(inc): return beam.Map(lambda x: beam.Row(a=x.col2 + inc)) diff --git a/website/www/site/content/en/documentation/sdks/yaml.md b/website/www/site/content/en/documentation/sdks/yaml.md index f52e07fd7184..d4829c163522 100644 --- a/website/www/site/content/en/documentation/sdks/yaml.md +++ b/website/www/site/content/en/documentation/sdks/yaml.md @@ -118,7 +118,7 @@ from the YAML file, use the command: ``` -gcloud beta dataflow yaml run $JOB_NAME \ +gcloud dataflow yaml run $JOB_NAME \ --yaml-pipeline-file=pipeline.yaml \ --region=$REGION ```