Skip to content

Download spark_python_task workspace files behind --download-spark-python-files flag#5892

Open
janniklasrose wants to merge 2 commits into
mainfrom
janniklasrose/bundle-generate-jobs-download-script-with-flag
Open

Download spark_python_task workspace files behind --download-spark-python-files flag#5892
janniklasrose wants to merge 2 commits into
mainfrom
janniklasrose/bundle-generate-jobs-download-script-with-flag

Conversation

@janniklasrose

Copy link
Copy Markdown
Contributor

Changes

Re-applies #5799 (reverted in #5837) and puts the behaviour behind a new opt-in flag.

bundle generate job only downloaded notebook tasks; files referenced by spark_python_task were left as absolute /Workspace/... paths, so the source file was never downloaded and the config wasn't portable. This PR restores the download+rewrite path (reusing the same markFileForDownload helper as pipeline libraries) but gates it behind a new --download-spark-python-files flag on bundle generate job, defaulting to off. Git-sourced files (source: GIT) and cloud URIs (dbfs:/, s3:/, adls:/, gcs:/) are left untouched.

The flag is threaded through the Downloader as a functional option (WithSparkPythonFiles), so the pipeline, app, and import callers are unaffected.

Why

#5799 was reverted in #5837 because a Python file often imports sibling files that the downloader does not capture, so downloading only the entry point can produce a job that fails at runtime with missing imports — whereas leaving the absolute workspace path alone "just works". Making the download opt-in keeps the default safe while letting users who know their spark_python_task is self-contained pull the file into their bundle.

Commits

  1. Re-apply Download spark_python_task workspace files in bundle generate job #5799 — a single re-revert of Revert #5799 #5837, restoring the original change verbatim (only the NEXT_CHANGELOG.md conflict resolved).
  2. Gate behind --download-spark-python-files — the new flag, functional-option plumbing, tests, and regenerated help/changelog.

Tests

  • Unit tests in bundle/generate/downloader_test.go: the download+rewrite path (with the option), the skipped cases (cloud URI, source: GIT), and a new test asserting the default-off behaviour makes no requests.
  • Acceptance test acceptance/bundle/generate/spark_python_task_job exercising the full CLI with the flag: a workspace-file task is downloaded and rewritten, a dbfs:/ cloud-URI task is preserved. Identical output on both terraform and direct engines.
  • Regenerated the bundle generate job --help golden file.

This pull request and its description were written by Isaac, an AI coding agent.

…generate job

This re-applies commit b2e7e6f (PR #5799), which was reverted in #5837
(commit 353cb5a). `bundle generate job` again downloads workspace files
referenced by `spark_python_task` and rewrites them to a relative path,
like it already does for notebooks. Git-sourced files and cloud URIs are
left untouched.

The behaviour is gated behind a feature flag in a follow-up commit.
…flag

Downloading workspace files referenced by a spark_python_task is now
opt-in via a new --download-spark-python-files flag on bundle generate
job (default off). A Python file often imports sibling files that the
downloader does not capture, so downloading only the entry point can
produce a job that fails at runtime with missing imports; this was the
reason #5799 was originally reverted in #5837.

The behaviour is threaded through the Downloader as a functional option
(WithSparkPythonFiles), so the pipeline, app, and import callers are
unaffected.
@github-actions

Copy link
Copy Markdown
Contributor

Approval status: pending

/acceptance/bundle/ - needs approval

8 files changed
Suggested: @denik
Also eligible: @pietern, @anton-107, @andrewnester, @shreyas-goenka, @lennartkats-db

/bundle/ - needs approval

Files: bundle/generate/downloader.go, bundle/generate/downloader_test.go
Suggested: @denik
Also eligible: @pietern, @anton-107, @andrewnester, @shreyas-goenka, @lennartkats-db

/cmd/bundle/ - needs approval

Files: cmd/bundle/generate/job.go
Suggested: @denik
Also eligible: @pietern, @anton-107, @andrewnester, @shreyas-goenka, @lennartkats-db

General files (require maintainer)

Files: NEXT_CHANGELOG.md
Based on git history:

  • @denik -- recent work in ./, cmd/bundle/generate/, bundle/generate/

Any maintainer (@andrewnester, @anton-107, @denik, @pietern, @shreyas-goenka, @simonfaltum, @renaudhartert-db) can approve all areas.
See OWNERS for ownership rules.

@eng-dev-ecosystem-bot

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: 714e817

Run: 29084704989

Env 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip Time
💚​ aws linux 4 4 230 1078 4:56
💚​ aws windows 4 4 232 1076 7:18
💚​ aws-ucws linux 4 4 314 996 5:41
💚​ aws-ucws windows 4 4 316 994 6:58
💚​ azure linux 4 4 230 1077 4:51
💚​ azure windows 4 4 232 1075 7:47
💚​ azure-ucws linux 4 4 316 993 5:33
💚​ azure-ucws windows 4 4 318 991 6:58
💚​ gcp linux 4 4 229 1079 5:01
💚​ gcp windows 4 4 231 1077 7:06
8 interesting tests: 4 RECOVERED, 4 SKIP
Test Name aws linux aws windows aws-ucws linux aws-ucws windows azure linux azure windows azure-ucws linux azure-ucws windows gcp linux gcp windows
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
🙈​ TestAccept/bundle/invariant/no_drift 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_endpoints/drift/recreated_same_name 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_indexes/recreate/embedding_dimension 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/ssh/connection 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
💚​ TestFetchRepositoryInfoAPI_FromRepo 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
💚​ TestFetchRepositoryInfoAPI_FromRepo/root 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
💚​ TestFetchRepositoryInfoAPI_FromRepo/subdir 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
Top 10 slowest tests (at least 2 minutes):
duration env testname
6:16 azure windows TestAccept
6:13 gcp windows TestAccept
6:13 aws windows TestAccept
6:03 aws-ucws windows TestAccept
5:59 azure-ucws windows TestAccept
2:55 gcp linux TestAccept
2:52 azure linux TestAccept
2:52 aws-ucws linux TestAccept
2:51 aws linux TestAccept
2:46 azure-ucws linux TestAccept

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants