File tree Expand file tree Collapse file tree 3 files changed +25
-4
lines changed
sdks/python/apache_beam/yaml/examples Expand file tree Collapse file tree 3 files changed +25
-4
lines changed Original file line number Diff line number Diff line change @@ -120,7 +120,20 @@ def test_kafka_read(
120120 auto_offset_reset_config ,
121121 consumer_config ):
122122 """
123- ...
123+ This PTransform simulates the behavior of the ReadFromKafka transform
124+ with the RAW format by simply using some fixed sample text data and
125+ encode it to raw bytes.
126+
127+ Args:
128+ pcoll: The input PCollection.
129+ format:
130+ topic:
131+ bootstrap_servers:
132+ auto_offset_reset_config:
133+ consumer_config:
134+
135+ Returns:
136+ A PCollection containing the sample text data in bytes.
124137 """
125138
126139 return (
@@ -131,7 +144,15 @@ def test_kafka_read(
131144@beam .ptransform .ptransform_fn
132145def test_run_inference (pcoll , inference_tag , model_handler ):
133146 """
134- ...
147+ This PTransform simulates the behavior of the RunInference transform.
148+
149+ Args:
150+ pcoll: The input PCollection.
151+ inference_tag: The tag to use for the returned inference.
152+ model_handler: A configuration for the respective ML model handler
153+
154+ Returns:
155+ A PCollection containing the enriched data.
135156 """
136157
137158 from apache_beam .ml .inference .base import PredictionResult
Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ create/write to a table. See [here](
6161https://cloud.google.com/bigquery/docs/datasets ) for how to create
6262BigQuery datasets.
6363
64- Then pipeline first reads the YouTube comments .csv dataset from
64+ The pipeline first reads the YouTube comments .csv dataset from
6565GCS bucket and performs some clean-up before writing it to a Kafka
6666topic. The pipeline then reads from that Kafka topic and applies
6767various transformation logic before ` RunInference ` transform performs
Original file line number Diff line number Diff line change 1616# limitations under the License.
1717#
1818
19- # Then pipeline first reads the YouTube comments .csv dataset from GCS bucket
19+ # The pipeline first reads the YouTube comments .csv dataset from GCS bucket
2020# and performs necessary clean-up before writing it to a Kafka topic.
2121# The pipeline then reads from that Kafka topic and applies various transformation
2222# logic before RunInference transform performs remote inference with the Vertex AI
You can’t perform that action at this time.
0 commit comments