[Feature Request] : Add an experimental beam command to the Python SDK
What would you like to happen?
Running a Beam YAML pipeline today means typing python -m apache_beam.yaml.main --yaml_pipeline_file=pipeline.yaml, which is long and gives little help when something goes wrong:
user mistakes such as a missing file or an unknown transform end in a Python traceback; the exit code doesn't tell a script whether the pipeline failed or could not be built; Ctrl-C leaves a traceback and can leave local workers running; when the SDK falls back from Prism to another local runner, nothing says which runner ran. I'd like to add an experimental beam console script to the Python SDK, starting with one subcommand:
beam run pipeline.yaml [pipeline options]
It would build and run the pipeline with apache_beam.yaml.main's own functions, so it behaves the same, and pass every other flag through as a pipeline option. On top of that it would:
print a short error instead of a traceback for user errors, with --verbose to show the traceback; use documented exit codes: 0 finished, 1 the pipeline failed, 2 usage error or the pipeline could not be built, 4 a required package is missing, 130 interrupted; cancel the pipeline on Ctrl-C; end with a line naming the runner that actually ran. The code would live in a new apache_beam/cli package, with --help and CHANGES.md marking it experimental, so flags can still change.
Later, separate PRs could add more subcommands. The first proposed is beam pipe --from SOURCE --to SINK, which builds a two-step YAML pipeline to convert files between CSV, JSON, Parquet and Avro, with --dry-run to print the YAML instead of running it. Each would be discussed in its own PR.
Design doc: <Apache Beam CLI Design Proposal, comments enabled>
Milestone Roadmap & Upstream Task List
To provide a single pane of glass for reviewers and community contributors, this task list tracks the modular PR rollout for the beam CLI and its associated core capabilities. Each PR is strictly scoped (<=450 lines) with isolated unit tests.
Preview Demo to try all of them together: Beam CLI Demo branch
Phase 1: Core CLI Foundation & Declarative Execution
- [x] PR 1: Core CLI Entrypoint &
beam run— #40968 (Merged)
Addsbeamconsole script andbeam run FILE.yamlwrappingapache_beam.yaml.mainwith clean exit codes and Ctrl-C cancellation. - [x] PR 2:
beam pipev1 (File-to-File Ingestion) — #41040 (Approved / In Review)
Declarative format conversion across CSV, JSON, Parquet, and Avro on local and cloud filesystems (gs://,s3://,hdfs://,azfs://), with--dry-runYAML export. - [ ] PR 3:
beam sqlInteractive Calcite SQL Shell — Staged (beam-sql-pr3, commitd5ad23f4cbb)
Interactive and batch (-e,-f) SQL shell (BeamSqlLine), sharing JAR cache in~/.beam/cachewith pre-flight JDK 11–25 validation. (Ready to open immediately upon PR 2 merge) - [ ] PR 4:
beam configNamed Profile Management — Staged (beam-config-pr4, commit391461463ad)
Persistent defaultPipelineOptionsprofiles in~/.beam/config.yamlwith disk caching and code-injection defenses. (Ready to open after PR 3) - [ ] PR 5: Fast
<90 msZero-SDK CLI Dispatcher — Staged (beam-fast-pr5)
Top-level fast dispatcher bypassing cold SDK import latency on--help/configpaths and static option-arity splitter.
Phase 2: Agent Protocols, Shorthand Transforms & Universal URIs
- [ ] PR 6: Agent JSON Output Contract &
beam run -
Deterministic--jsonoutput envelope with 4-channeluntrusted_dataisolation andstdinpipeline execution (beam run -). - [ ] PR 7:
beam pipev2: In-Flight Transforms & Quality DLQ
AST-verifiedcallable:expressions for--whereand--select, flat--dlqrouting (ReadCsvWithDlq), and fusion-safe--assert-counts. - [ ] PR 8: Universal URI Scheme Registry
Direct URI routing forbigquery://,postgres://,pubsub://,kafka://, andiceberg://ontostandard_io.yamlwith zero Docker loopback XLang.
Phase 3: Data Quality, Equivalence Verification & Pipeline Lifecycle
- [ ] PR 9:
beam diffCross-Store Equivalence Verifier
Keyed dataset equivalence engine (--key,--rtol,--atol,--max-bytes) exiting0on match or6on mismatch using $O(1)$ memory. - [ ] PR 10:
beam inspectSchema & Stats Inspector
<200 msmetadata and column inspector with--searchfilter across files, BigQuery tables, and Lakehouse snapshots. - [ ] PR 11: Pre-Flight Static Validation (
beam check,beam io,beam doctor)
Offline YAML/AST schema validation, ~200-token connector cards, and environment diagnostics (JDK, credentials, cache). - [ ] PR 12: Remote Timeout Continuity & Cost Guardrails
Wall-clock--wait-timeoutwith detached job state tracking (beam wait,beam cancel) and--max-bytesscan budget enforcement. - [ ] PR 13:
beam tail [-f]Stream Peek & Live Follow
Bounded stream preview and Linux-style live follow across Pub/Sub, Kafka, and storage shard partitions. - [ ] PR 14: Agent Skill Specification &
beam --llms-txt
Self-documenting agent interfaces and plugin hooks (apache_beam.cli.commands).
Phase 4: Lakehouse, Cross-Engine CDC & Serverless Packaging
- [ ] PR 15:
beam packageZero-Docker YAML Flex Templates
<2spackager generating regional Flex Template specifications without requiring local Docker daemon or Cloud Build. - [ ] PR 16: Cross-Engine CDC & Zero-Copy Lakehouse Bridges
Turnkey--cdc --primary-keyreplication (Debezium/Spanner/Delta/Iceberg -> BigQuery Storage Write API & Iceberg v2 MoR) and<100 ms--zero-copymanifest registration.
Supporting Upstream Bug Fixes & Feature Requests
- Merged Supporting Fixes:
- Filed Core Bug Reports:
- #41076 —
DataflowMetrics._populate_metricsKeyError on tentative/committed metrics. - #41077 —
yaml_mappingSyntaxError on Python keyword column names (in,from,is). - #41078 —
DirectRunnerPrism fallback NotImplementedError on batched DoFns. - #41079 — Java SDK harness
Rowresolution in generic filter. - #41080 — Python
--spark_submit_uber_jarstorage level flag requirement.
- #41076 —
- Filed Core Feature Requests:
- #41081 — Dead-letter error handling on
ReadFromCsvandReadFromJson. - #41223 — Native
Expect/ data quality PTransform with tagged DLQ outputs. - #41224 — Declarative
IntervalJoincomposite transform with watermark skew circuit breaker. - #41225 — Turnkey Confluent Schema Registry Wire Format deserializer in
ReadFromKafka. - #41226 — Continuous streaming snapshot commit watermarking in
beam.managed.Write(ICEBERG). - #41227 — Partition-aware zero-copy metadata translation from Delta Lake to Apache Iceberg.
- #41081 — Dead-letter error handling on
Issue Priority
Priority: 2 (default / most feature requests should be filed as P2)
Issue Components
- [x] Component: Python SDK
- [ ] Component: Java SDK
- [ ] Component: Go SDK
- [ ] Component: Typescript SDK
- [ ] Component: IO connector
- [x] Component: Beam YAML
- [ ] Component: Beam examples
- [ ] Component: Beam playground
- [ ] Component: Beam katas
- [ ] Component: Website
- [ ] Component: Infrastructure
- [ ] Component: Spark Runner
- [ ] Component: Flink Runner
- [ ] Component: Prism Runner
- [ ] Component: Hazelcast Jet Runner
- [ ] Component: Google Cloud Dataflow Runner
Hi, I’d like to help implement this. I’d start with a minimal beam run command that reuses the YAML runner, then cover option forwarding, user errors, exit codes and interruption cleanup. Before starting, is the proposed console entrypoint approved, or should the first contribution be CLI tests and a small prototype for review?
Hi, I’d like to help implement this. I’d start with a minimal beam run command that reuses the YAML runner, then cover option forwarding, user errors, exit codes and interruption cleanup. Before starting, is the proposed console entrypoint approved, or should the first contribution be CLI tests and a small prototype for review?
Darsh, Lets connect offline to see where we can use your help for this project!
Planning to .take-issue to project manage/develop large pieces but could use help where possible. Updated description for the plan of work to be done.