Repository navigation
feat(python-notebook-migration): add notebook-migration-service microservice in backend - #5258
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #5258 +/- ##
============================================
+ Coverage 54.64% 54.71% +0.06%
- Complexity 2922 2929 +7
============================================
Files 1109 1113 +4
Lines 42840 43010 +170
Branches 4608 4629 +21
============================================
+ Hits 23412 23533 +121
- Misses 18060 18088 +28
- Partials 1368 1389 +21
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
| config | throughput | MB/s | latency | max Δ latest / 7d | |
|---|---|---|---|---|---|
| 🔴 | bs=10 sw=10 sl=64 | 395 | 0.241 | 24,786/36,810/36,810 us | 🔴 +24.7% / 🔴 +146.1% |
| 🔴 | bs=100 sw=10 sl=64 | 822 | 0.501 | 118,129/168,841/168,841 us | 🔴 +25.9% / 🔴 +68.5% |
| ⚪ | bs=1000 sw=10 sl=64 | 968 | 0.591 | 1,029,455/1,078,519/1,078,519 us | ⚪ within ±5% / 🔴 +14.5% |
Baseline details
Latest main dc33251 from same runner
| config | metric | PR | latest main | 7d avg | Δ latest | Δ 7d |
|---|---|---|---|---|---|---|
| bs=10 sw=10 sl=64 | throughput | 395 tuples/sec | 456 tuples/sec | 799.7 tuples/sec | -13.4% | -50.6% |
| bs=10 sw=10 sl=64 | MB/s | 0.241 MB/s | 0.278 MB/s | 0.488 MB/s | -13.3% | -50.6% |
| bs=10 sw=10 sl=64 | p50 | 24,786 us | 19,880 us | 12,125 us | +24.7% | +104.4% |
| bs=10 sw=10 sl=64 | p95 | 36,810 us | 29,571 us | 14,959 us | +24.5% | +146.1% |
| bs=10 sw=10 sl=64 | p99 | 36,810 us | 29,571 us | 18,503 us | +24.5% | +98.9% |
| bs=100 sw=10 sl=64 | throughput | 822 tuples/sec | 851 tuples/sec | 1,069 tuples/sec | -3.4% | -23.1% |
| bs=100 sw=10 sl=64 | MB/s | 0.501 MB/s | 0.52 MB/s | 0.652 MB/s | -3.7% | -23.2% |
| bs=100 sw=10 sl=64 | p50 | 118,129 us | 116,062 us | 92,709 us | +1.8% | +27.4% |
| bs=100 sw=10 sl=64 | p95 | 168,841 us | 134,112 us | 100,227 us | +25.9% | +68.5% |
| bs=100 sw=10 sl=64 | p99 | 168,841 us | 134,112 us | 109,877 us | +25.9% | +53.7% |
| bs=1000 sw=10 sl=64 | throughput | 968 tuples/sec | 950 tuples/sec | 1,114 tuples/sec | +1.9% | -13.1% |
| bs=1000 sw=10 sl=64 | MB/s | 0.591 MB/s | 0.58 MB/s | 0.68 MB/s | +1.9% | -13.1% |
| bs=1000 sw=10 sl=64 | p50 | 1,029,455 us | 1,051,715 us | 899,197 us | -2.1% | +14.5% |
| bs=1000 sw=10 sl=64 | p95 | 1,078,519 us | 1,088,104 us | 945,162 us | -0.9% | +14.1% |
| bs=1000 sw=10 sl=64 | p99 | 1,078,519 us | 1,088,104 us | 986,231 us | -0.9% | +9.4% |
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,506.80,200,128000,395,0.241,24786.12,36809.66,36809.66
1,100,10,64,20,2434.51,2000,1280000,822,0.501,118129.12,168841.43,168841.43
2,1000,10,64,20,20658.81,20000,12800000,968,0.591,1029455.16,1078519.38,1078519.38|
/request-review @mengw15 |
There was a problem hiding this comment.
Pull request overview
Adds a new backend microservice (notebook-migration-service) to mediate between Texera and a JupyterLab stack for the Python Notebook Migration tool, including DB persistence for notebook + workflow mapping and wiring into the build/CI/dev-proxy.
Changes:
- Introduces
notebook-migration-serviceDropwizard app with notebook/Jupyter REST endpoints plus workflow write-access enforcement. - Adds Scala tests covering DB transaction behavior, auth gating, and stubbed Jupyter success/failure paths.
- Wires the service into root sbt aggregation, CI platform matrix, shared
StorageConfig, and the frontend dev proxy.
Reviewed changes
Copilot reviewed 16 out of 18 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
notebook-migration-service/src/main/scala/org/apache/texera/service/NotebookMigrationService.scala |
Dropwizard application entrypoint; registers Jersey pattern, auth stack, resources, and request logging. |
notebook-migration-service/src/main/scala/org/apache/texera/service/NotebookMigrationServiceConfiguration.scala |
Dropwizard configuration class. |
notebook-migration-service/src/main/scala/org/apache/texera/service/resource/NotebookMigrationResource.scala |
Implements Jupyter connectivity + notebook upload, and DB store/fetch endpoints. |
notebook-migration-service/src/main/scala/org/apache/texera/service/resource/WorkflowAccessResource.scala |
Helper for checking workflow WRITE privilege. |
notebook-migration-service/src/main/scala/org/apache/texera/service/resource/HealthCheckResource.scala |
Adds a /healthcheck endpoint. |
notebook-migration-service/src/test/scala/org/apache/texera/service/resource/NotebookMigrationResourceSpec.scala |
Unit tests for DB persistence/rollback, access checks, and Jupyter stub interactions. |
notebook-migration-service/src/test/scala/org/apache/texera/service/NotebookMigrationServiceRunSpec.scala |
Verifies service run registers resources and auth features. |
notebook-migration-service/src/main/resources/notebook-migration-service-web-config.yaml |
Service port/logging config for Dropwizard. |
notebook-migration-service/build.sbt |
Service-specific build and dependencies. |
notebook-migration-service/project/build.properties |
Pins sbt version for the module build. |
notebook-migration-service/LICENSE-binary |
Binary distribution license manifest for dependency licensing checks. |
notebook-migration-service/NOTICE-binary |
Generated NOTICE aggregation for the service distribution. |
common/config/src/main/resources/storage.conf |
Adds storage.jupyter config (URL + token env overrides). |
common/config/src/main/scala/org/apache/texera/common/config/StorageConfig.scala |
Exposes Jupyter URL/token accessors. |
frontend/proxy.config.json |
Dev proxy route for /api/notebook-migration to localhost:9098. |
build.sbt |
Registers NotebookMigrationService as an sbt subproject and aggregates it. |
bin/licensing/check_binary_deps.py |
Includes the new service’s LICENSE-binary in the licensing check list. |
.github/workflows/build.yml |
Adds the new service to the platform CI matrix (dist + tests + licensing). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <[email protected]> Signed-off-by: Ryan Zhang <[email protected]>
…migration-service' into migration-tool-backend-notebook-migration-service
mengw15
left a comment
There was a problem hiding this comment.
LGTM. All earlier threads addressed, several with bonus improvements (the registerAuthFeatures helper with the anti-drift comment, the deliberately self-contained WorkflowAccessResource semantics, the Jackson-helper introduction for user-data JSON paths). Test coverage is solid — happy paths, transaction rollback on FK failure, 403 enforcement, fake-Jupyter stub for HTTP success/failure paths, name-validation rejection cases. Thanks for the iteration.
Forward-looking architectural note — not blocking this PR.
The per-user-pod deployment model used here (each user runs their own pod with both JupyterLab and a co-located notebook-migration-service JVM) is a reasonable v1 simplification: Jupyter URL is statically known within the pod, no routing layer is needed, and the @volatile var jupyterIframeURL singleton works because cross-user isolation is enforced at the pod boundary. The same-user-multi-tab case (two tabs of one user racing the singleton) is bounded — UX-only, since DB stays authoritative via store-notebook-and-mapping / fetch-notebook-and-mapping — and the comment in NotebookMigrationResource.scala already documents the cross-user limit.
The reason this is worth flagging at all is that Texera's other microservices follow a pretty consistent pattern:
| Service | Deployment | Role |
|---|---|---|
access-control-service |
global | auth + Envoy ExtAuthz routing |
file-service |
global | stateless API over shared LakeFS |
config-service |
global | stateless config provider |
workflow-compiling-service |
global | stateless compilation |
computing-unit-managing-service |
global | orchestrator that routes to per-user compute pods |
agent-service |
global | stateless |
| compute / Jupyter pods | per-user | hold per-user kernel / notebook state |
"Orchestrator services are global, stateful resources are per-user." computing-unit-managing-service is the closest analog — it's a global service that resolves per-user compute pods via the computing-unit-<cuid>.<pool>-svc.<namespace>.svc.cluster.local k8s DNS pattern (see checkComputingUnitAccess in AccessControlResource.scala). notebook-migration-service plays the same kind of orchestrator role for Jupyter pods, so over time it would be worth bringing into that pattern.
A rough migration path, staged so no single PR is too large:
- API stateless refactor (backend-only, small): drop the
@volatile var jupyterIframeURL, changegetJupyterIframeURLto takenotebookNameas a parameter, remove the side-effect fromsetNotebook. Eliminates the multi-tab race even before any deployment change. - Per-user Jupyter URL resolution (backend + Helm): add
jupyterUrlFor(uid)/jupyterTokenFor(uid)helpers backed by either k8s DNS lookup (mirroringcomputing-unit-managing-service) or a small registry table; spawn Jupyter pods per user with addressable k8s services. - Deployment topology (Helm only): move
notebook-migration-serviceout of the per-user pod into a global Deployment; add NetworkPolicy to prevent cross-user Jupyter access. - Frontend coordination (the migration-tool series — #5260 and the upcoming UI PRs): frontend passes
notebookNametogetJupyterIframeURL, manages per-workflow naming, optionally adopts awf<wid>_<name>.ipynbconvention.
Open questions for when this gets picked up: k8s DNS pattern vs registry table for Jupyter URL resolution; per-pod tokens (more secure) vs shared (simpler); on-demand vs always-on Jupyter pod lifecycle. None of these need to be answered now — happy to defer the whole roadmap until the migration tool has shipped and real usage shows what scale / multi-tenancy issues actually surface. Just wanted to lay out the direction in one place so the per-user-pod choice doesn't get inherited by accident in later PRs.
Again: none of this blocks #5258 — v1 ships as-is. Approving.
…pache#8032) ### What changes were proposed in this PR? `notebook-migration-service` read one Jupyter URL and token from configuration as process-wide values. That is safe only under the per-user-pod model, where each user runs their own pod. A single global instance would hand every user the same Jupyter and the same token. This resolves both per user instead. This is stage 2 of the staged roadmap in the architectural note on apache#5258. Stage 1 (apache#7390) and stage 4 (apache#7671) are merged. Stage 3 (apache#8006) depends on this one. **Registry table** A new `user_jupyter` table holds one row per user whose Jupyter has been provisioned, keyed on `uid`. Both the internal and public URLs are stored rather than derived at read time, matching how `workflow_computing_unit.uri` is the recorded source of truth for a computing unit's address. Storing them lets the deployment change its addressing scheme without a code change, which is what apache#8006 needs in order to choose between per-user hostnames and a path prefix. **Derived tokens** Each user's token is `HMAC-SHA256(secret, uid)`, computed from `storage.jupyter.token-secret`. No credential is stored at rest, any replica of the service derives the same value, and rotation is a secret change. The service refuses to start when per-user Jupyter is on with an empty secret: an empty HMAC key is publicly known, so tokens would still look distinct per user while anyone could derive anyone else's. **Fallback gated on a flag, not on row absence** With `kubernetes.jupyter-enabled` off, every user resolves to the statically configured Jupyter, which is how the single-node (apache#7932) and local-dev (apache#7934) deployments run one shared JupyterLab. With it on, a user with no row has nothing provisioned yet and gets an unavailable response. Falling back to the shared server there would hand an unprovisioned user somebody else's notebooks, and would let `delete-notebook` remove another user's file. The flag is deliberately separate from `kubernetes.enabled`, so a deployment can run computing units on Kubernetes without per-user Jupyter. **Provisioning** `JupyterKubernetesClient` mirrors the computing unit's `KubernetesClient`, including the hostname and subdomain pair that makes the pod FQDN resolve through a headless service. `get-jupyter-iframe-url` and `set-notebook` provision on demand; `get-jupyter-url` and `delete-notebook` resolve only, so reading a URL or deleting a file never starts a pod. A registered pod that stops answering is discarded and rebuilt, since the row would otherwise outlive the pod and point every later request at nothing. Two concurrent first requests are resolved by the primary key: the loser keeps the winner's row, which holds the same uid-derived addresses. The uid always comes from the authenticated session and never from a request body, so one user cannot address another's Jupyter. Two notes on the implementation. The Kubernetes client is built on demand rather than at object initialisation, unlike the computing unit's, because the single-node and local-dev deployments have no cluster to build one against and never provision. Adding `io.fabric8:kubernetes-client` also raises three transitive versions over Dropwizard's pins (`slf4j-api` to 2.0.13, `jackson-dataformat-yaml` and `jackson-datatype-jsr310` to 2.17.0); `LICENSE-binary` claims are updated to match. Out of scope, and left to apache#8006: the Helm templates, the NetworkPolicy, and the global Deployment. Also out of scope is reclaiming idle pods. A dead pod self-heals on next use, but nothing reaps one that is merely unused, and the row's `ON DELETE CASCADE` drops the registration without deleting the pod. Until a deployment supplies a browser-reachable address, `kubernetes.jupyter-public-url-template` defaults to empty and the public URL falls back to the in-cluster one. ### Any related issues, documentation, discussions? Closes apache#7665 Parent issue apache#4301 Stage 3 (apache#8006) is built directly on this branch, so every decision here has been exercised on a real cluster rather than only in unit tests. See the verification comment below. ### How was this PR tested? `NotebookMigrationService/test` passes (72) and `Config/test` passes (71). `Test/compile` across the whole repo is clean, as is `scalafmtCheckAll`. New coverage: token derivation is deterministic per uid, distinct across 50 uids, and changes with the secret; the start-up guard rejects an empty secret only when the feature is on. Resolution falls back with the feature off, returns the row with it on, returns nothing for an unregistered user, and never returns one user's Jupyter to another. Provisioning is exercised against a stubbed Kubernetes client across every branch: fresh provision, reuse of a live pod, rebuild of a pod that stopped answering, cleanup when readiness never arrives, public URL templating, and the concurrent-registration race. The existing `withFakeJupyter` suite is untouched and still passes on the stub bound to `localhost:9100`, which is the point of the flag-gated fallback: test users have no registry row and take the configured path exactly as before. Applied `sql/texera_ddl.sql` to a scratch database the way CI does, confirmed the table shape, and confirmed that deleting a user removes their registration row. `check_binary_deps.py` passes under both the PR-mode and the strict nightly invocations, and `NOTICE-binary` matches generator output byte for byte. Not tested on a live cluster. The chart has no notebook-migration or Jupyter templates yet, and the in-cluster pod address does not resolve from outside the cluster, so end to end Kubernetes validation belongs to apache#8006. ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code (Claude Opus 5)
…Kubernetes (apache#8073) ### What changes were proposed in this PR? The notebook migration tool runs in the single-node Docker stack (apache#7931) and in local development (apache#7933), but the Helm chart has no `notebook-migration-service` and no JupyterLab. A Kubernetes deployment shows the tool in the workspace with nothing serving its endpoints. This adds both, following the chart's existing convention that orchestrator services are global and stateful resources are per user. `notebook-migration-service` becomes a global Deployment alongside the other services, with a ServiceAccount whose Role is scoped to the JupyterLab namespace only. Per-user JupyterLab pods live in their own namespace behind a headless Service, addressed as `jupyter-<uid>.<service>.<namespace>.svc.cluster.local`, with a ResourceQuota bounding the pool and an optional prepull DaemonSet. A NetworkPolicy stops one user's pod reaching another's. One `values.yaml` switch, `notebookMigrationService.enabled`, gates the Deployment, the routes, the pool, and the button in the workspace, and it defaults to off. **Enabling the tool now requires a token secret** `notebookMigrationService.jupyterTokenSecret` has no default. Every user's JupyterLab token is `HMAC(secret, uid)` and `/jupyter/<uid>/` is deliberately unauthenticated at the gateway, so a secret shipped in this repo would be public and would let anyone derive any user's token. The Secret template wraps the value in `required`, so enabling the tool without one fails at install with a message naming the key rather than coming up quietly insecure. Generate one with `openssl rand -hex 32`. `values-development.yaml` carries an explicitly dev scoped value so the Minikube flow keeps working. **How browser traffic reaches the right pod** This is the design decision worth reviewing closely. JupyterLab is loaded in an iframe and then issues its own requests for assets, contents and kernel websockets. None of those can carry a Texera token, and Texera has no session cookie, so the caller cannot be authenticated per request. Each user's JupyterLab is therefore served under `/jupyter/<uid>/`, and the gateway's existing ExtAuthz hook resolves that uid to the pod's recorded address and rewrites `Host`. It reuses `dynamic-routes`, its `DynamicResolver` backend, and the `SecurityPolicy` that already forwards `Host`, so no new gateway machinery is introduced. That mechanism routes; it does not authorize. What keeps users apart is the per-user JupyterLab token from apache#7665, derived from a server held secret and unguessable. Anyone who can reach the gateway can route to any user's pod and will get a 403 from JupyterLab without that user's token. The NetworkPolicy is defence in depth on top, closing the one case where a genuinely hostile neighbour runs: another user's pod. This is a weaker posture than a per-request authorization check, and it is stated plainly in the code rather than left to be inferred. Resolution fails closed. A uid too large for an `Int`, a missing registry row, and a recorded address that will not parse all take one path to 403, never a 500. **This PR is not Helm only, unlike what apache#8006 anticipated** Four backend changes are inseparable from a working deployment: * JupyterLab serves under a configurable base path, since routing by path requires it, and the recorded internal address carries that path because JupyterLab serves every endpoint under it, `/api` included. * `access-control-service` gains the Jupyter case in `authorize()`. The uid regex is built from `kubernetes.jupyter-base-url` and the prefix is quoted, so a base path is matched as a path and not as a pattern. * JupyterLab is told which origin may embed it. The setting and the pod's `TEXERA_ORIGIN` arrived with apache#8032; this PR passes it to `--NotebookApp.allow_origin`, without which a proxy that rewrites `Host` makes JupyterLab's own cross origin check fail on cookie authenticated requests and kernel startup is blocked entirely. * The browser facing origin is settable directly, not only derived from a gateway hostname, because a deployment reached by port forward or NodePort has no hostname to derive from. When it is derived, the scheme comes from whether a certificate is configured, `gatewayConfig.issuer` or `tlsSecretName`, because the chart declares both listeners unconditionally and a hostname alone does not say which one serves. `jupyterPool.basePath` is honoured by every layer that reads it: the pod's `base_url`, the recorded internal URL, the public URL template, the gateway route match, and the regex `access-control-service` matches on. All five derive from the one value, so the prefix cannot be obeyed in one place and ignored in another. **Rebuilt pods and pooled connections** A Jupyter pod is named after its uid, so a rebuild reuses the hostname with a new IP. The gateway keeps pooled upstream connections to the old address for its default idle hour, and a request handed one of those hangs until the route timeout, because a departed pod IP is unrouted rather than refused. A BackendTrafficPolicy sets `connectionIdleTimeout` to 30s on the dynamic route so those connections are retired promptly. Measured on the cluster below, a rebuild went from 14 failures in 40 requests scattered over minutes to 4, confined to the moment of the switch. Computing units share this route and are unaffected either way: their pods are keyed on a never reused cuid, so no hostname of theirs ever moves. **Two routes needed explicit timeouts** Envoy's default request timeout is 15 seconds, which is shorter than two things this tool does. `/api/notebook-migration` now carries a 3m timeout. Provisioning waits for a pod to terminate and then to answer, up to 60s each, so the default was truncating work the service would have completed: rebuilds measured 30 seconds and returned 504 to the browser while the pod came up fine underneath, with an immediate retry succeeding. The route serving `/api/chat` and `/api/models` takes its timeout from `gatewayConfig.llmRequestTimeout`, defaulting to 10m to match `python-notebook-migration-timeout-minutes`. LLM completions routinely run past 15 seconds, and the upstream call succeeds and is then discarded, so every conversion failed while burning the API call. This also fixes the agent chat, which shares the route. Known limitations, both worth their own issues: * JupyterLab pods have no persistent volume, so a pod restart empties `work/`. Notebooks survive in the database but are not re-uploaded automatically. The same is true of a single-node container restart, so this is not specific to Kubernetes. * A dead pod self-heals on the next request, but an idle one is never reclaimed. ### Any related issues, documentation, discussions? Closes apache#8006 Parent issue apache#4301 Builds on apache#7665 (PR apache#8032, merged), which resolves the Jupyter URL and token per user. Roadmap context is the architectural note on apache#5258. ### How was this PR tested? Unit tests pass across the touched modules: `Config/test` (71), `AccessControlService/test` (68), `NotebookMigrationService/test` (122), with `scalafmtCheckAll` clean. `helm template` renders with the feature on and off; with it disabled the chart emits no Jupyter or notebook-migration objects at all, and with it enabled but no token secret the render fails as intended. Deployed and exercised end to end on a local Minikube cluster running Calico, chosen because Minikube's default CNI creates NetworkPolicy objects without enforcing them, which would make the isolation commit look correct while enforcing nothing. All seven endpoints were driven through the gateway: `get-jupyter-url`, `get-jupyter-iframe-url`, `set-notebook`, `delete-notebook`, and the three mapping endpoints. `set-notebook` was confirmed by reading the file back through Jupyter's own contents API, and `delete-notebook` by that read then returning 404. Requests with no token, a garbage token, and an `INACTIVE` role are refused; `../../etc/x.ipynb`, a non `.ipynb` name, and malformed JSON bodies are all 400. Per-user separation was tested with two real users. Each got its own pod, the quota moved from one to two, and the registry held two rows with uid scoped addresses. Each served token matched an independent HMAC derivation of that uid, and each token returned 200 on its own pod and 403 on the other. Routing to a uid with no pod, and to a uid that does not exist, both return 403. Isolation was tested with an ablation rather than a single observation. `jupyter-1` cannot reach `jupyter-2` on 8888 by pod IP or by DNS, in both directions, while the same pod reaches the `texera-dev` namespace in the same probe, which rules out broken networking. Removing the policy makes the connection succeed and restoring it blocks again. Kernel startup was tested the way a browser does it, with a cookie and an `Origin` header rather than a token query parameter, because a token authenticated request skips JupyterLab's origin check and would pass even when the browser path is broken. `POST /api/sessions` returns 201 and the pod logs `Kernel started`. Cell click sync was confirmed in the browser. The failure paths were provoked rather than assumed. Writing an unparseable address into a registry row returns 403 and logs the `URISyntaxException`, and 200 returns once restored. Deleting a pod without touching its row causes the next request to log that the pod no longer accepts its current token, discard the row and provision a replacement. Setting `jupyterPool.basePath` to `/lab/notebooks` moves the pod's `base_url`, the recorded URL, the gateway route and the regex together, and removing `KUBERNETES_JUPYTER_BASE_URL` from `access-control-service` restores the break, which is what proves the wiring rather than the default doing the work. ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code (Claude Opus 5) --------- Co-authored-by: Meng Wang <[email protected]>
### What changes were proposed in this PR? Remove unused code from the Scala sources and tests of the Amber engine and web server, `workflow-core`, `workflow-operator`, `observability` and the notebook-migration service, and narrow the database reads of the account, notification, dashboard-search, Hub and Jupyter-registration lookups to the columns and rows they use (**+285/-316 lines**). Production behavior does not change. Two CSV tests that are named for multi-line data now read the multi-line file. **Unused code** - **Unused bindings:** pattern, `catch` and callback bindings that nothing reads become `_` in `ClusterListener`, `DeadLetterMonitorActor`, `Utils`, `SequentialRecordStorage`, the argument parsers of `ComputingUnitMaster` and `ComputingUnitWorker`, `WebsocketInput`, `WorkflowWebsocketResource`, `AiAssistantManager`, `ExecFactory`, `VirtualIdentityUtils`, `URLFetchUtil` and `HtmlVizOpDesc`. The two argument parsers end in `case _`, since `case Nil` already takes the empty list. - **`S3StorageClient.uploadObject`:** - `readChunk` uses a plain `while` loop instead of assigning inside the loop condition. - The parts upload in a `while` loop that adds each `CompletedPart` to the Java list the SDK takes. Before, an `Iterator` of `(partNumber, size)` tuples became a Scala `List` and then went back through `.asJava`. - Each part is copied out of the reused buffer once and streamed from that copy. `buffer.take` and `RequestBody.fromBytes`, which calls `Arrays.copyOf` itself, copied it twice. The content provider gives each SDK attempt a fresh stream over the same bytes. - Part numbers, upload order, part sizes, the `application/octet-stream` content type and the read of the next chunk after each upload are unchanged. - **`SQLSourceOpExec.fetchBatchByBoundary`:** returns the result of the type `match` as a `val` instead of overwriting a `var` that starts as `null`. - **Worker statistics:** `StatisticsManager.getStatistics` drops the executor parameter it has not read since its sink-operator check went away. `DataProcessor` and both statistics specs stop passing an executor to it. - **Telemetry:** `WorkflowMetricsRecorder` drops a `LazyLogging` it never logs with, and `WorkflowMetrics` drops the `Cancelled` outcome and the `Unknown` workflow kind that nothing records. - **Scan sources:** `SkippedRowReporter` drops its uncalled `count`, and `ArrowSourceOpExec` drops a batch counter it only increments. - **Arrow Flight benchmark:** sorts each run's latencies once, instead of once per percentile. - **Test helpers:** - `DPThreadSpec.awaitCond` drops its unused default budget, and the spec's callbacks name their unused argument `_`. - `ExternalAuthProvisionerSpec`'s `seedUser` and `seedUserWithEmail` drop the `avatar` parameter that no test passes. - `DictionaryMatcherOpExecSpec.withExecutor`, `HashJoinOpSpec.tuple` and the tuple builders of `IntervalOpExecSpec` drop defaults that every caller overrides. - `PythonWorkerPool` starts its stdout and stderr reader threads without keeping the references it never reads. - **Test fixtures:** - `TestOperators` drops `asterixDBSourceOpDesc`, a descriptor for the AsterixDB server at `ipubmed4.ics.uci.edu` that only its own `TestOperatorsSpec` case still built. It also drops the `multiLine` parameter that `getCsvScanOpDesc` never read. - `headerlessSmallMultiLineDataCsvScanOpDesc` reads `country_sales_headerless_small_multi_line.csv` again, so `DataProcessingSpec`'s headerless multi-line case runs on multi-line data. - The matching `CSVScanSourceOpDescSpec` case now reads that file too, and checks the scanned rows: 100 rows of 14 fields, a quoted value with commas, and two values with line breaks. **Database reads** - **Account, login and notification queries:** - `AuthResource`'s login query selects the user columns and the password hash, instead of every column of the joined `auth_provider` and `user` rows. `ExternalAuthProvisioner`'s lookup selects only the user columns. - The admin-bootstrap and add-email checks in `AuthResource`, the duplicate-email check in `AdminUserResource` and `UserResource.isJoiningReasonRequired` read one column, or use `selectOne`, instead of a full user row. - `GmailResource` reads only the requester's name and the admins' email addresses, compiles its email regex once, and passes the subject and the domain-suffixed content to `createMimeMessage` instead of copying the `EmailMessage`. - **Dashboard search:** - `searchAllResources` builds its results in one pass over the first `count` rows. Before, it built a list of entries, filtered out the omitted ones, and scanned the list again for `hasMismatch`. - `getOrderFields` drops the `case None` branch and the private `getColumnField` with its `case _ => null`, which its regex makes unreachable, and compiles the regex once. - `WorkflowSearchQueryBuilder` builds its access condition as a `val` instead of overwriting a `DSL.trueCondition()` initializer. `VersionedResourceSearchQueryBuilder` drops a `getGroupByFields` override that returns the base default. - `VersionedResourceTables.hydrate` stops pairing each entry with a resource ID that every caller discarded, drops `idOf`, and reads the owner email from the record without building a `User` POJO. - **Hub (`HubResource`):** - The versioned-resource lookup selects the resource columns, the owner email and the privilege that `hydrate` reads, instead of every joined column. `VersionedResourceTables.hydrationFields` defines that list next to `hydrate`, because a query that left a column out would get a `null` email or privilege without an error. - `isLikedHelper` collects the liked IDs with `fetchSet`. Like/unlike and clone check for an existing row with `fetchExists` instead of fetching it, and like/unlike no longer goes through the batch helper. - `getCounts` reuses each entity type's request group, and drops the zero entries it added for missing view counts, since the lookup already defaults to 0. - **Notebook migration:** `NotebookMigrationResource` stops selecting the notebook ID it never reads, and drops `JSONB` casts that its typed fields make redundant. `JupyterEndpointResolver` selects the two registration URLs instead of a full `user_jupyter` row, and `JupyterProvisioner` derives a healthy registration's token once instead of twice. **Tests for rewritten paths no test reached** - `DatasetSearchQueryBuilderSpec` runs a dataset search over a dataset that lakeFS rejects, and expects it left out with `hasMismatch` set. - `HubResourceSpec` fetches such a dataset by ID and expects it dropped. - `AdminUserResourceSpec` moves a user to an address no other account uses. | Event | PR / Commit | | --- | --- | | Introduced by | Amber engine and web server: apache#945 (2021-01-05), apache#1101 (2021-05-03), apache#1387 (2022-02-10), apache#1381 (2022-05-13), apache#1671 (2022-11-07), apache#1677 (2022-11-07), apache#2060 (2023-07-14), apache#2529 (2024-03-29), apache#2570 (2024-04-07), apache#2808 (2024-09-02); account and notification queries: apache#3080 (2024-11-19), apache#3393 (2025-04-29), apache#3440 (2025-06-08), apache#4185 (2026-02-16), apache#7055 (2026-08-10), apache#7758 (2026-08-21), apache#7639 (2026-08-30), apache#7978 (2026-08-31); dashboard search and Hub: apache#2358 (2024-02-23), apache#2838 (2024-09-25), apache#3252 (2025-02-09), apache#3446 (2025-05-26), apache#3442 (2025-06-28), apache#3519 (2025-07-09), apache#7928 (2026-08-26), apache#7930 (2026-09-01), apache#8890 (2026-10-27); `workflow-core`: apache#2271 (2024-01-18), apache#3183 (2024-12-31), apache#4067 (2025-11-25); `workflow-operator`: apache#1013 (2021-02-11), apache#1866 (2023-03-23), apache#3139 (2024-12-06), apache#3186 (2024-12-31), apache#6947 (2026-10-02); `observability`: apache#5376 (2026-10-27); notebook migration: apache#5258 (2026-06-24), apache#8032 (2026-09-03); tests and benchmark: apache#1044 (2021-02-25), apache#1083 (2021-04-25), apache#1227 (2021-07-25), apache#2254 (2023-12-13), apache#2302 (2024-02-05), apache#3425 (2025-05-26), apache#4836 (2026-05-03), apache#5439 (2026-06-06), apache#5557 (2026-06-11), apache#6077 (2026-07-03), apache#7116 (2026-07-31), apache#7207 (2026-08-14), apache#7870 (2026-08-23), apache#7875 (2026-08-31), apache#9534 (2026-11-19), apache#9518 (2026-11-21) | | Usage removed by | AsterixDB fixture: apache#1118 (2021-05-11, `Disable dependent tests with AsterixDB`) commented out its only test use, which apache#3294 (2025-03-04) deleted; multi-line fixture: apache#3111 (2024-11-26, `Update amber to depend on sub projects`) pointed `headerlessSmallMultiLineDataCsvScanOpDesc` at the single-line file; `awaitCond`'s default budget: apache#9534 (2026-11-19, `test(amber): share engine and service test fixtures`) routed its last callers through a helper that always passes one; `getStatistics`' executor parameter: apache#3312 (2025-03-12, `Remove Sink Operator in the Backend`) dropped its only read, the sink-operator check; everything else: unused or redundant since introduction | As of 2026-11-24, the AsterixDB fixture has had no test use for over 5 years, and the headerless multi-line CSV fixture has read single-line data for about 12 months. ### Any related issues, documentation, discussions? Closes apache#9680. ### How was this PR tested? The first commit (`cb95cd29b7`) ran on its base, `main` at `de3f021dec`. The second commit ran on this branch before it (`2e980903c8`, after merging `main`) and after it, the third likewise on `dee7711a88`, the fourth on `3870a2da97`, and the fifth on `4c244837bf`. Both used Windows 11, JDK 17, `UDF_PYTHON_PATH` set to Python 3.12, and Docker for the RustFS container that `S3StorageClientSpec` starts. The e2e case uses the Hadoop Iceberg catalog because no REST catalog runs on this machine: ```bash WUNUSED='set ThisBuild / scalacOptions += "-Wunused:patvars,params,privates"' sbt "$WUNUSED" "WorkflowCore/testOnly org.apache.texera.amber.core.executor.CoreExecutorReflectionSpec org.apache.texera.amber.util.VirtualIdentityUtilsSpec org.apache.texera.service.util.S3StorageClientSpec" sbt "$WUNUSED" "WorkflowOperator/testOnly org.apache.texera.amber.operator.TestOperatorsSpec org.apache.texera.amber.operator.dictionary.DictionaryMatcherOpExecSpec org.apache.texera.amber.operator.hashJoin.HashJoinOpSpec org.apache.texera.amber.operator.intervalJoin.IntervalOpExecSpec org.apache.texera.amber.operator.source.fetcher.URLFetchUtilSpec org.apache.texera.amber.operator.source.fetcher.URLFetcherOpExecSpec org.apache.texera.amber.operator.source.scan.csv.CSVScanSourceOpDescSpec org.apache.texera.amber.operator.source.scan.csv.CSVScanSourceOpExecSpec org.apache.texera.amber.operator.source.sql.* org.apache.texera.amber.operator.visualization.htmlviz.HtmlVizOpDescSpec org.apache.texera.amber.util.python.PythonWorkerPoolSpec" sbt "$WUNUSED" "WorkflowExecutionService/testOnly org.apache.texera.amber.clustering.ClusterListenerSpec org.apache.texera.amber.engine.architecture.messaginglayer.DeadLetterMonitorActorSpec org.apache.texera.amber.engine.architecture.worker.DPThreadSpec org.apache.texera.amber.engine.common.UtilsSpec org.apache.texera.amber.engine.common.storage.SequentialRecordStorageSpec org.apache.texera.web.ComputingUnitMasterSpec org.apache.texera.web.ComputingUnitWorkerSpec org.apache.texera.web.WebsocketInputSpec org.apache.texera.web.resource.WorkflowWebsocketResourceSpec org.apache.texera.web.resource.aiassistant.AiAssistantManagerSpec org.apache.texera.web.resource.auth.ExternalAuthProvisionerSpec" sbt "$WUNUSED" "WorkflowExecutionService/testOnly org.apache.texera.web.TexeraWebApplicationSpec org.apache.texera.web.resource.GmailResourceSpec org.apache.texera.web.resource.auth.AuthResourceSpec org.apache.texera.web.resource.auth.ExternalAuthProvisionerSpec org.apache.texera.web.resource.auth.OrcidAuthResourceSpec org.apache.texera.web.resource.dashboard.DashboardResourceSpec org.apache.texera.web.resource.dashboard.DatasetSearchQueryBuilderSpec org.apache.texera.web.resource.dashboard.ModelSearchQueryBuilderSpec org.apache.texera.web.resource.dashboard.UnifiedResourceSchemaSpec org.apache.texera.web.resource.dashboard.VersionedResourceTablesSpec org.apache.texera.web.resource.dashboard.WorkflowSearchQueryBuilderSpec org.apache.texera.web.resource.dashboard.admin.user.AdminUserResourceSpec org.apache.texera.web.resource.dashboard.file.DatasetResourceSpec org.apache.texera.web.resource.dashboard.file.WorkflowResourceSpec org.apache.texera.web.resource.dashboard.hub.EntityTablesSpec org.apache.texera.web.resource.dashboard.hub.HubEntityModelSpec org.apache.texera.web.resource.dashboard.hub.HubResourceSpec org.apache.texera.web.resource.dashboard.user.UserResourceSpec org.apache.texera.web.resource.dashboard.user.workflow.WorkflowPublishSpec org.apache.texera.web.service.WorkflowEmailNotifierSpec" STORAGE_ICEBERG_CATALOG_TYPE=hadoop sbt "$WUNUSED" "WorkflowExecutionService/testOnly org.apache.texera.amber.engine.e2e.DataProcessingSpec -- -z headerlessMultiLineDataCsv" sbt "$WUNUSED" Observability/test NotebookMigrationService/test "WorkflowOperator/testOnly org.apache.texera.amber.operator.source.scan.*" sbt "$WUNUSED" "WorkflowExecutionService/testOnly org.apache.texera.amber.engine.architecture.coordinator.promisehandlers.ConsoleMessageHandlerSpec org.apache.texera.amber.engine.architecture.messaginglayer.WorkerTimerServiceSpec org.apache.texera.amber.engine.architecture.worker.DPThreadSpec org.apache.texera.amber.engine.architecture.worker.DataProcessorRPCHandlerInitializerSpec org.apache.texera.amber.engine.architecture.worker.DataProcessorSpec org.apache.texera.amber.engine.architecture.worker.WorkerSpec org.apache.texera.amber.engine.architecture.worker.WorkflowWorkerSpec org.apache.texera.amber.engine.architecture.worker.managers.StatisticsManagerSpec org.apache.texera.amber.engine.architecture.worker.managers.WorkerManagersSpec org.apache.texera.amber.engine.architecture.worker.promisehandlers.EndChannelHandlerSpec org.apache.texera.amber.engine.architecture.worker.promisehandlers.EndHandlerSpec org.apache.texera.amber.engine.architecture.worker.promisehandlers.FinalizeCheckpointHandlerSpec org.apache.texera.amber.engine.architecture.worker.promisehandlers.StartChannelHandlerSpec org.apache.texera.amber.engine.architecture.worker.promisehandlers.StartHandlerSpec org.apache.texera.amber.engine.common.UtilsSpec org.apache.texera.amber.engine.faulttolerance.CheckpointSpec org.apache.texera.web.observability.WorkflowMetricsRecorderSpec" sbt "$WUNUSED" "WorkflowExecutionService/testOnly org.apache.texera.web.resource.dashboard.DatasetSearchQueryBuilderSpec org.apache.texera.web.resource.dashboard.DashboardResourceSpec org.apache.texera.web.resource.dashboard.admin.user.AdminUserResourceSpec org.apache.texera.web.resource.dashboard.hub.HubResourceSpec org.apache.texera.web.ComputingUnitMasterSpec org.apache.texera.web.ComputingUnitWorkerSpec" sbt "$WUNUSED" "WorkflowExecutionService/testOnly org.apache.texera.web.resource.dashboard.DatasetSearchQueryBuilderSpec org.apache.texera.web.resource.dashboard.ModelSearchQueryBuilderSpec org.apache.texera.web.resource.dashboard.VersionedResourceTablesSpec org.apache.texera.web.resource.dashboard.DashboardResourceSpec org.apache.texera.web.resource.dashboard.hub.EntityTablesSpec org.apache.texera.web.resource.dashboard.hub.HubEntityModelSpec org.apache.texera.web.resource.dashboard.hub.HubResourceSpec" sbt WorkflowCore/scalafmtCheckAll WorkflowOperator/scalafmtCheckAll WorkflowExecutionService/scalafmtCheckAll Observability/scalafmtCheckAll NotebookMigrationService/scalafmtCheckAll "WorkflowCore/scalafixAll --check" "WorkflowOperator/scalafixAll --check" "WorkflowExecutionService/scalafixAll --check" "Observability/scalafixAll --check" "NotebookMigrationService/scalafixAll --check" ``` - JUnit XML, compared per test: - First commit: the first three test commands and the e2e case run 36 suites that load every file the commit changes, and `SQLSourceOpExecSpec` calls `fetchBatchByBoundary` for each numeric type through a mocked JDBC result. All 554 tests pass on `main` and all 553 with the commit. Each test has the same outcome as on `main`; the missing one is the removed `asterixDBSourceOpDesc` case. - Second commit: the fourth command runs the 20 suites that load the account, notification, dashboard-search and Hub code, against an embedded PostgreSQL. All 525 tests pass before and after the commit, each with the same outcome. - Third commit: the sixth and seventh test commands run every `Observability`, `NotebookMigrationService` and scan-source suite, plus the worker, statistics, checkpoint and telemetry suites that load the changed classes. Before and after it, 581 of the 595 tests in these 48 suites pass, each with the same outcome. The other 14 fail on both sides on this machine: 13 `ParquetScanSourceOpDescSpec` cases need Hadoop's Windows binaries, and one `FileScanSourceOpDescSpec` case hits a Windows temp-file lock. - Fourth commit: the eighth test command runs the six suites it touches. All 179 tests pass, the three new ones included. - Fifth commit: the ninth test command runs the seven suites that load `VersionedResourceTables` or the Hub query. All 182 tests pass. - On the second commit's head, all 55 suites of the first two rounds pass, the e2e case included: 1,059 tests. - `S3StorageClientSpec` runs its 34 cases against RustFS 1.0.0 in Testcontainers on both sides. They include a 6 MiB upload (a 5 MiB part and a 1 MiB tail) that downloads back byte for byte, an empty upload, and the abort when the input stream fails after the first part. - With the fixture pointed back at `country_sales_headerless_small.csv`, the strengthened `CSVScanSourceOpDescSpec` case fails: row 8 reads `Republic of the Congo` instead of `Republic,of,the,Congo`. The `DataProcessingSpec` case runs the multi-line file through the engine and gets the same 100 rows that the single-line file gives on `main`. - scalafmt and scalafix pass on all five touched modules. - With `-Wunused:patvars,params,privates`, the compiler reports 26 unused names in the files of the first commit on `main`. That commit removes 24 of them. The other two are `config` and `cr`, which the `@OnOpen` and `@OnClose` methods of `WorkflowWebsocketResource` need for the WebSocket API's signatures; they are reported on both. ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code (Claude Opus 5.5)
What changes were proposed in this PR?
Introduces the microservice that mediates between Texera and the JupyterLab docker stack landed in
migration-tool-jupyter-docker. Adds a new SBT subprojectnotebook-migration-serviceplus shared config and a frontend dev-proxy route.New SBT subproject
notebook-migration-service/:build.sbtandproject/build.properties— module SBT setup; module depends on the existingAuth,Config, andDAOprojectssrc/main/scala/.../NotebookMigrationService.scala— DropwizardApplicationentry point; sets Jersey URL pattern to/api/*, registers the resource class, initializes the shared SQL connection viaSqlServer.initConnection(StorageConfig.jdbcUrl, …), and wires inRequestLoggingFilter.src/main/scala/.../NotebookMigrationServiceConfiguration.scala— DropwizardConfigurationsubclass.src/main/scala/.../resource/NotebookMigrationResource.scala— five REST endpoints under/notebook-migration:GET /get-jupyter-url— health-checks the Jupyter container and returns its base URL.GET /get-jupyter-iframe-url— returns the iframe-ready URL fornotebook.ipynb.POST /set-notebook— receives a notebook JSON, PUTs it into JupyterLab via its/api/contents/work/{name}API.POST /store-notebook-and-mapping— persists a notebook + workflow-notebook mapping into Postgres in a single transaction (writes to thenotebookandworkflow_notebook_mappingtables added bymigration-tool-database-tables).POST /fetch-notebook-and-mapping— returns the most recent notebook + mapping for a given (wid, vid).src/main/resources/logback.xml— logging config.src/main/resources/notebook-migration-service-web-config.yaml— Dropwizard server config (HTTP port9098, DB connection refs).Root build wiring:
build.sbt— declares the newNotebookMigrationServiceSBT subproject and adds it to theTexeraProjectaggregation.Shared config:
common/config/src/main/resources/storage.conf— newjupyter { url = "http://localhost:9100" }block, overridable viaSTORAGE_JUPYTER_URL.common/config/src/main/scala/.../StorageConfig.scala— adds thejupyterURLaccessor.Frontend dev proxy:
frontend/proxy.config.json— routes/api/notebook-migration/*tohttp://localhost:9098.Any related issues, documentation, discussions?
Closes #5257
Parent issue #4301
migration-tool-database-tablesfeat(python-notebook-migration): add database tables for Notebook Migration tool #5055 — the resource imports jOOQ-generatedNotebook/WorkflowNotebookMappingclasses that only exist once the schema PR is merged.migration-tool-jupyter-dockeris whatStorageConfig.jupyterURLpoints to. Without it running, the Jupyter-related endpoints return a 500 with"Cannot connect to Jupyter server". Service still starts and the DB-persistence endpoints work in isolation.How was this PR tested?
Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Opus 4.7)