Skip to content

refactor(dataset-mount): mount region datasets in the scheduler, not per worker - #15

Closed
aicam wants to merge 1 commit into
demo/mount-b2from
feat/mount-scheduler-split
Closed

aicam wants to merge 1 commit into
demo/mount-b2from
feat/mount-scheduler-split

Conversation

@aicam

@aicam aicam commented Aug 10, 2026

Copy link
Copy Markdown
Owner

What & why

Today the dataset FUSE mount happens per worker — PythonWorkflowWorker.startPythonProcess() calls DatasetMountManager.ensureMounted() for every bound dataset, so N workers on a Python UDF fire N (idempotent) mount calls, and the invocation lives inside a Python-only class. Any future operator type (e.g. a Java UDF) would have to copy that call.

This PR moves the mount up to the region scheduler and splits planning from execution:

  • Planning (RegionExecutionManager.mountRegionDatasets()): gather the deduplicated set of dataset locators across the region's operators and call DatasetMountManager.ensureAllMounted(plan) once, before any worker starts (guarded by an AtomicBoolean so both launch phases mount at most once). Operator-agnostic — any operator that populates PhysicalOp.mountedDatasets participates with no mount code of its own.
  • Execution (ensureAllMounted → ensureMounted): unchanged mount primitive — POST to the node mounter, wait for propagation, idempotent.
  • Lookup (resolveMountPath): the worker now does a pure in-pod path lookup, no mount.

Design

flowchart LR
    subgraph SCHED["RegionExecutionManager — PLANNING (once per region)"]
        P["<b>mountRegionDatasets()</b><br/>plan = region.getOperators<br/>.flatMap(_.mountedDatasets.values).toSet<br/><i>deduped · operator-agnostic · single pass</i>"]
    end
    subgraph EXEC["EXECUTION — in the CU pod's mount namespace"]
        E["<b>ensureAllMounted(plan)</b><br/>ensureMounted(locator) each<br/>POST http://NODE_IP:8100/mount<br/>wait for propagation<br/><i>synchronized · idempotent</i>"]
    end
    subgraph WORK["PythonWorkflowWorker — per worker"]
        W["<b>resolveMountPath(locator)</b><br/>PURE LOOKUP — no mount<br/>bind var → /mnt/texera-mounts/&lt;repo&gt;/&lt;commit&gt;"]
    end
    P -->|"TODAY: controller pod == worker pod"| E
    E -->|"mount visible in the shared pod namespace"| W
    P -.->|"FUTURE: distributed workers → MountDatasets(plan) RPC per pod"| E
    NM["node mounter DaemonSet<br/>(privileged) · GeeseFS"]:::infra
    E -->|"POST /mount {cuid,repo,commit,jwt}"| NM
    NM -.->|"propagates into pod"| W
    classDef infra fill:#ffe6a3,stroke:#d79b00,color:#7a4f00
    style SCHED fill:#b1ddf0,stroke:#10739e
    style EXEC fill:#ffe6a3,stroke:#d79b00
    style WORK fill:#d5e8d4,stroke:#82b366
Loading

Distribution note (intentional, flagged in code)

The mount executes in the controller's process, and a FUSE mount is only visible inside the mount namespace it lands in. This is correct only while the controller and a region's workers share one computing-unit pod (today's model). Both new methods carry a Warning: comment: a future distributed-worker deployment would dispatch the execution step to each worker's pod/node. Planning and lookup stay unchanged — ensureAllMounted is the single namespace-bound seam.

How it was tested

E2E on a dedicated minikube profile running these images: a PythonUDFSourceV2 → PythonUDFV2 workflow, where the UDF reads a file from a scheduler-mounted dataset. Result: state: Completed, the UDF returned the mounted file's contents, and the CU log shows Requesting mount of dataset-1:<hash> exactly once for the region — confirming the dedup + single-pass behavior. WorkflowExecutionService/compile green under JDK17.

AI disclosure

Generated-by: Claude Opus 4.8

🤖 Generated with Claude Code

https://claude.ai/code/session_01LWctadaFS9S8CwMhhVZquv

…per worker

Move the dataset FUSE mount out of the per-worker PythonWorkflowWorker up to
the region scheduler. RegionExecutionManager.mountRegionDatasets() gathers the
deduplicated set of dataset locators across the region's operators and calls
DatasetMountManager.ensureAllMounted once, before any worker starts (guarded by
an AtomicBoolean so both launch phases mount at most once). The worker now calls
DatasetMountManager.resolveMountPath, a pure in-pod lookup with no mount.

New: ensureAllMounted (planning/execution) and resolveMountPath (lookup);
ensureMounted stays as the idempotent execution primitive. Both new methods
carry a "Warning:" comment: the mount executes in the controller's pod and is
only correct while the controller and a region's workers share one CU pod; a
distributed-worker deployment would dispatch execution to each worker's pod.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LWctadaFS9S8CwMhhVZquv
@github-actions

Copy link
Copy Markdown

👋 Thanks for opening this pull request, @aicam!

It looks like the pull request description doesn't quite follow our template yet:

  • The What changes were proposed in this PR? section is missing; please keep the template's headings.
  • The How was this PR tested? section is missing; please keep the template's headings.
  • The Was this PR authored or co-authored using generative AI tooling? section is missing; please keep the template's headings.

Filling out the template helps reviewers understand and triage your contribution faster. Please edit the description to complete it. This message will disappear automatically once the template is followed.

You can find the template prompts by editing the description, or see CONTRIBUTING.md for the full contribution flow.

@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: @aglinxinyuan
    You can notify them by mentioning @aglinxinyuan in a comment.

@github-actions

Copy link
Copy Markdown

⚠️ Benchmark changes need a look

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

Compared against main d15b3d1 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 393 0.24 25,297/32,279/32,279 us 🔴 +18.2% / ⚪ within ±5%
🟢 bs=100 sw=10 sl=64 948 0.579 103,465/123,135/123,135 us 🟢 -21.8% / ⚪ within ±5%
🟢 bs=1000 sw=10 sl=64 1,115 0.68 902,031/924,311/924,311 us 🟢 -5.6% / ⚪ within ±5%
Baseline details

Latest main d15b3d1 from same runner

config metric PR latest main 7d avg Δ latest Δ 7d
bs=10 sw=10 sl=64 throughput 393 tuples/sec 472 tuples/sec n/a -16.7% n/a
bs=10 sw=10 sl=64 MB/s 0.24 MB/s 0.288 MB/s n/a -16.7% n/a
bs=10 sw=10 sl=64 p50 25,297 us 21,408 us n/a +18.2% n/a
bs=10 sw=10 sl=64 p95 32,279 us 29,429 us n/a +9.7% n/a
bs=10 sw=10 sl=64 p99 32,279 us 29,429 us n/a +9.7% n/a
bs=100 sw=10 sl=64 throughput 948 tuples/sec 930 tuples/sec n/a +1.9% n/a
bs=100 sw=10 sl=64 MB/s 0.579 MB/s 0.567 MB/s n/a +2.1% n/a
bs=100 sw=10 sl=64 p50 103,465 us 103,573 us n/a -0.1% n/a
bs=100 sw=10 sl=64 p95 123,135 us 157,526 us n/a -21.8% n/a
bs=100 sw=10 sl=64 p99 123,135 us 157,526 us n/a -21.8% n/a
bs=1000 sw=10 sl=64 throughput 1,115 tuples/sec 1,061 tuples/sec n/a +5.1% n/a
bs=1000 sw=10 sl=64 MB/s 0.68 MB/s 0.647 MB/s n/a +5.1% n/a
bs=1000 sw=10 sl=64 p50 902,031 us 945,725 us n/a -4.6% n/a
bs=1000 sw=10 sl=64 p95 924,311 us 978,856 us n/a -5.6% n/a
bs=1000 sw=10 sl=64 p99 924,311 us 978,856 us n/a -5.6% 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,508.91,200,128000,393,0.240,25297.32,32278.58,32278.58
1,100,10,64,20,2108.90,2000,1280000,948,0.579,103464.55,123134.57,123134.57
2,1000,10,64,20,17941.28,20000,12800000,1115,0.680,902030.64,924311.40,924311.40

@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has
not had any activity for 30 days. It will be closed in 7 days if no
further activity occurs.

If this PR is still relevant, please:

  • Push new commits or rebase onto the latest main, or
  • Comment with a status update, or
  • Address any open review feedback.

To exempt this PR from auto-close, a maintainer can add the pinned label.
Thank you for your contribution to Apache Texera (incubating)!

@github-actions github-actions Bot added the stale label Sep 14, 2026
@github-actions

Copy link
Copy Markdown

This pull request has been automatically closed due to 37 days of inactivity.
If you would like to continue this work, please re-open the PR or open a new
one referencing this. Thank you for your contribution.

@github-actions github-actions Bot closed this Sep 21, 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