derrickaw commented on code in PR #35931:
URL: https://github.com/apache/beam/pull/35931#discussion_r2304688376


##########
website/www/site/content/en/documentation/sdks/yaml.md:
##########
@@ -742,6 +742,74 @@
 
 would write to files like `gs://path/to/2016/08/04/dated-output*.json`.
 
+A user can also use the `% include` directive to pull in other common 
templates:
+
+<PATH_TO_YOUR_REPO>/pipeline.yaml
+```sh
+pipeline:
+  transforms:
+    - name: Read from GCS
+      type: ReadFromText
+      config:
+{% include '<PATH_TO_YOUR_REPO>/submodules/readFromText.yaml' %}
+   - name: Write to GCS
+      type: WriteToText
+      input: Read from GCS
+      config:
+        path: "gs://MY-BUCKET/wordCounts/"
+```
+
+<PATH_TO_YOUR_REPO>/submodules/readFromText.yaml
+```sh
+        path: {{readFromText.path}}
+```
+
+This pipeline can be ran like this:
+
+```sh
+python -m apache_beam.yaml.main \
+    --yaml_pipeline_file=pipeline.yaml \
+    --jinja_variables='{"readFromText": {"path": 
"gs://dataflow-samples/shakespeare/kinglear.txt"}}'
+```
+
+The `% import` jinja directive can also be used to pull in macros:
+
+<PATH_TO_YOUR_REPO>/pipeline.yaml
+```sh
+{% import '<PATH_TO_YOUR_REPO>/macros.yaml' as macros %}
+
+pipeline:
+  type: chain
+  transforms:
+
+# Read in text file
+{{ macros.readFromText(readFromText) | indent(4, true) }}
+
+# Write to text file on GCS, locally, etc
+   - name: Write to GCS
+      type: WriteToText
+      input: Read from GCS
+      config:
+        path: "gs://MY-BUCKET/wordCounts/"
+```
+
+<PATH_TO_YOUR_REPO>/macros.yaml
+```sh

Review Comment:
   done, thanks



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@beam.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to