Skip to content

feat(python-udf): bind mounted datasets to variables - #10

Closed
aicam wants to merge 1 commit into
feat/dataset-mount-2-cu-uifrom
feat/dataset-mount-3-udf-variables
Closed

aicam wants to merge 1 commit into
feat/dataset-mount-2-cu-uifrom
feat/dataset-mount-3-udf-variables

Conversation

@aicam

@aicam aicam commented Jul 24, 2026

Copy link
Copy Markdown
Owner

What changes were proposed in this PR?

Let a Python UDF use datasets mounted on its computing unit by binding each dataset to a variable whose value, at runtime, is the dataset's local mount path — replacing the single "Mount dataset" property with a variable ↔ mounted-dataset list. A UDF can bind several datasets and reference them by name (e.g. open(f"{A}/file.csv")).

  • Operator — mountDataset string → datasetVariables list of { variableName, datasetPath }; variable names validated as Python identifiers, each path resolved to a repository:commitHash locator.
  • Engine — carry a variableName → locator map through PhysicalOp and WorkerConfig; before the Python process starts, the worker ensures each dataset is mounted (idempotent — converges with any explicit per-CU mount) and passes a { variableName → localPath } map in the startup config.
  • Python runtime — inject each binding into the UDF module as a module-level variable holding its local path.
  • Property editor — a table widget for variable/dataset rows, with options drawn from the datasets mounted on the active computing unit.

Because the feature is only usable once this lands (mounting alone does nothing without a consumer), the old single-dataset property is replaced outright — no backward-compatibility shim.

Any related issues, documentation, discussions?

Implements apache#6864 · part of apache#6606. Stacks on the "Mount datasets into computing unit" UI (previous PR in this stack).

How was this PR tested?

Compiled (WorkflowExecutionService / WorkflowOperator) and updated the affected unit tests (PythonWorkflowWorkerStartupConfigSpec, test_run_python_worker.py). Production frontend build passes. End-to-end on minikube: a Python UDF bound a mounted dataset to a variable and read a ~2 GB sharded PyTorch model from the variable's path via torch.load, with bit-exact output (model_output_sum == expected_sum).

Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Opus 4.8

Replace the Python UDF's single "Mount dataset" property with a
"Mounted dataset variables" list mapping each dataset to a variable. At
runtime each variable holds the dataset's local mount path, so a UDF can
reference several mounted datasets by name (e.g. open(f"{A}/file.csv")).
The engine carries a variable->locator map through PhysicalOp and
WorkerConfig; the worker ensures each dataset is mounted and hands the
paths to the Python process, which injects each as a module-level
variable. The property editor gains a variable/dataset table widget.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01H27sHgS29u2JcLYPPR6Hdx
@github-actions

Copy link
Copy Markdown

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • Contributors with relevant context: @ELin2025
    You can notify them by mentioning @ELin2025 in a comment.

@github-actions

Copy link
Copy Markdown

✅ No material benchmark regressions detected

🟢 5 better · 🔴 0 worse · ⚪ 10 noise (<±5%) · 0 without baseline

Compared against main f926f5c benchmarked on this same runner, so the delta is largely free of cross-runner hardware noise. The "7d avg" column still reflects the gh-pages dashboard. Treat <±5% as noise unless repeated.

Dashboard · Run

config throughput MB/s latency max Δ latest / 7d
🟢 bs=10 sw=10 sl=64 348 0.212 27,401/35,793/35,793 us 🟢 -17.8% / ⚪ within ±5%
⚪ bs=100 sw=10 sl=64 721 0.44 135,994/166,333/166,333 us ⚪ within ±5% / ⚪ within ±5%
⚪ bs=1000 sw=10 sl=64 812 0.496 1,228,102/1,265,976/1,265,976 us ⚪ within ±5% / ⚪ within ±5%
Baseline details

Latest main f926f5c from same runner

config metric PR latest main 7d avg Δ latest Δ 7d
bs=10 sw=10 sl=64 throughput 348 tuples/sec 315 tuples/sec n/a +10.5% n/a
bs=10 sw=10 sl=64 MB/s 0.212 MB/s 0.192 MB/s n/a +10.4% n/a
bs=10 sw=10 sl=64 p50 27,401 us 33,321 us n/a -17.8% n/a
bs=10 sw=10 sl=64 p95 35,793 us 39,657 us n/a -9.7% n/a
bs=10 sw=10 sl=64 p99 35,793 us 39,657 us n/a -9.7% n/a
bs=100 sw=10 sl=64 throughput 721 tuples/sec 724 tuples/sec n/a -0.4% n/a
bs=100 sw=10 sl=64 MB/s 0.44 MB/s 0.442 MB/s n/a -0.5% n/a
bs=100 sw=10 sl=64 p50 135,994 us 134,339 us n/a +1.2% n/a
bs=100 sw=10 sl=64 p95 166,333 us 170,549 us n/a -2.5% n/a
bs=100 sw=10 sl=64 p99 166,333 us 170,549 us n/a -2.5% n/a
bs=1000 sw=10 sl=64 throughput 812 tuples/sec 826 tuples/sec n/a -1.7% n/a
bs=1000 sw=10 sl=64 MB/s 0.496 MB/s 0.504 MB/s n/a -1.6% n/a
bs=1000 sw=10 sl=64 p50 1,228,102 us 1,210,169 us n/a +1.5% n/a
bs=1000 sw=10 sl=64 p95 1,265,976 us 1,246,773 us n/a +1.5% n/a
bs=1000 sw=10 sl=64 p99 1,265,976 us 1,246,773 us n/a +1.5% n/a
Raw CSV
config_idx,batch_size,schema_width,string_len,num_batches,total_ms,total_tuples,total_bytes,tuples_per_sec,mb_per_sec,lat_p50_us,lat_p95_us,lat_p99_us
0,10,10,64,20,574.48,200,128000,348,0.212,27400.58,35792.73,35792.73
1,100,10,64,20,2773.38,2000,1280000,721,0.440,135993.82,166333.19,166333.19
2,1000,10,64,20,24623.51,20000,12800000,812,0.496,1228102.29,1265975.96,1265975.96

@aicam

aicam commented Jul 24, 2026

Copy link
Copy Markdown
Owner Author

Superseded — this feature is now being contributed directly to apache/texera:main as two balanced PRs: apache#6866 (out-of-pod mount infrastructure) and apache#6867 (platform mount integration), tracked in apache#6606. Closing this fork-staging PR.

@aicam aicam closed this Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant