Skip to content

[Core][runtime_env] Support Kerberos-authenticated HTTP/HTTPS package downloads - #66279

Open
OneSizeFitsQuorum wants to merge 11 commits into
ray-project:masterfrom
OneSizeFitsQuorum:OneSizeFitsQuorum/webhdfs
Open

OneSizeFitsQuorum wants to merge 11 commits into
ray-project:masterfrom
OneSizeFitsQuorum:OneSizeFitsQuorum/webhdfs

Conversation

@OneSizeFitsQuorum

@OneSizeFitsQuorum OneSizeFitsQuorum commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Enable opt-in Kerberos authentication for HTTP and HTTPS package downloads used by working_dir and py_modules. Set RAY_RUNTIME_ENV_HTTP_KERBEROS_HOSTS to exact DNS names to use smart_open's existing kerberos=True support and node credentials. Reject conflicting Bearer authentication and embedded URL credentials, and retain standard TLS and redirect behavior. Ray does not acquire or renew tickets or provide gateway failover.

The branch includes current master. The net diff contains only the Kerberos implementation, tests, and documentation in the migrated MyST page. Dependency locks match master, including its Torch 2.10 upgrade and wheel hash refresh.

Related to #66278. A fresh search of open Kerberos PRs found no overlapping runtime-environment change; #66523 concerns the Data read_hive API, and #60050 covers Bearer authentication.

Validation in the existing Python 3.11 environment with smart_open 6.2.0:

PYTHONPATH=python python -m pytest --confcutdir=python/ray/tests/unit python/ray/tests/unit/test_runtime_env_http_kerberos.py python/ray/tests/unit/test_runtime_env_validation.py python/ray/tests/unit/test_runtime_env_working_dir.py -q -p no:cacheprovider
# 155 passed

PYTHONPATH=python python -m pytest python/ray/tests/test_runtime_env_packaging.py -q -p no:cacheprovider -k 'http_handler or http_downloader or https_downloader or TestParseUri or TestS3Protocol or TestAbfssProtocol'
# 32 passed, 96 deselected

pre-commit run
# All applicable checks passed for the merge resolution.
pre-commit run --from-ref origin/master --to-ref HEAD
# All applicable checks passed for the final PR diff through the push hook.

The migrated section also rendered successfully in a standalone Sphinx/MyST HTML build with warnings treated as errors. make -C doc rtd-build stopped in rtd-doctor with "no pinned versions parsed from requirements-doc.lock.txt", before the full documentation build.

The Kerberos tests simulate authentication tokens and include real local HTTP/HTTPS servers and TLS certificate validation. These post-merge checks do not require a KDC. Full CI for the updated head is pending.

AI assistance was used. The merge commit is DCO signed.

@OneSizeFitsQuorum
OneSizeFitsQuorum marked this pull request as ready for review September 18, 2026 10:52
@OneSizeFitsQuorum
OneSizeFitsQuorum requested review from a team as code owners September 18, 2026 10:52

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for downloading runtime environment dependencies (such as working_dir or py_modules) from Kerberos/SPNEGO-protected HTTPS services. It updates smart_open to version 7.1.0 and implements a custom KerberosSession and HTTPSAdapter to handle Kerberos authentication and redirects securely. Feedback suggests instantiating a fresh ssl.SSLContext per connection pool key in HTTPSAdapter to avoid potential thread-safety or cross-pollution issues.

@ray-gardener ray-gardener Bot added docs An issue or change related to documentation core Issues that should be addressed in Ray Core security The issue or proposal related to security community-contribution Contributed by the community labels Sep 18, 2026
@OneSizeFitsQuorum
OneSizeFitsQuorum requested a review from a team as a code owner September 18, 2026 15:45
@MortalHappiness MortalHappiness self-assigned this Sep 24, 2026
dstrodtman added a commit that referenced this pull request Sep 28, 2026
…ervability pages to MyST (#66461)

## Why are these changes needed?

Converts the last non-API-reference RST pages under `ray-core/`,
`data/`, and `rllib/` to MyST Markdown, plus the `train/` and
`ray-observability/` pages that `doc/BUILD.bazel` names by path. The API
reference trees (`*/api/`, `rllib/package_ref/`, and
`ray-core/compiled-graph/compiled-graph-api`) stay RST for now.

Each page gets its own commit, so you can review one file at a time.
Every commit renames the page's literal `.rst` paths in
`doc/BUILD.bazel` to `.md`. These paths are in `exclude` lists and in
the explicit `files` lists of `doctest[data-gpu]` and
`doctest[train-gpu]`, and they don't glob. Without the edit, an excluded
page would silently join its target once it's `.md`, and an included
page would silently drop out of it.

Conversions are format-only: labels, headings, and prose are unchanged.
A final whitespace-only commit soft-wraps the prose. `ray-soft-wrap`'s
`verify.py` confirms non-whitespace bytes, rendered HTML, and
idempotence for all 11 files.

### `rllib/getting-started`: doctest target removed

The first commit deletes `doctest[rllib2]`, the only target over
`rllib/getting-started.rst`, before the page converts. The target is
tagged `manual` with a hang TODO, so no premerge or postmerge step has
run it, and nothing else references it (`git grep rllib2` is empty). Its
15 `testcode` blocks had no `testoutput`, so they asserted nothing. The
12 visible blocks become display-only `python` code blocks. The three
`:hide:` blocks held `.stop()` cleanups that never rendered, so they're
deleted. `doctest[rllib]` still excludes the page. If these examples
should be validated later, a `doc_code/` script is the better route than
reviving the hanging target. cc @elliot-barn, who owns the TODO.

This commit isn't buildable on its own. It turns a `.. testcode::` that
had no blank line before its body into a `.. code-block:: python`, still
with no blank line, and docutils reads the body as extra arguments to
the directive. The later conversion commit fixes it in the `.md`, and a
squash merge never puts the intermediate commit on master.

### Doctest coverage

Docs-only PRs don't run doctests premerge. This PR edits
`doc/BUILD.bazel`, so every library's docs example step runs, but
premerge can't show the conversion kept the same blocks. For that, I
parsed each `.md` and the `.rst` it replaced with Ray's `pytest-sphinx`
fork, the same parser the doctest macro runs, and asserted identical
sections (directive, body, `:options:`, `:skipif:`) and examples.

| Page | BUILD role | Examples before → after |
| --- | --- | --- |
| `ray-core/handling-dependencies` | `doctest[core]` exclude | 17 → 17 |
| `ray-core/tasks/nested-tasks` | `doctest[core]` exclude | 0 → 0
(`literalinclude` of a tested `doc_code/` file) |
| `data/batch-inference` | `doctest_each` exclude, `doctest[data-gpu]`
files | 7 → 7 |
| `data/transforming-data` | `doctest_each` exclude, `doctest[data-gpu]`
files | 24 → 24 |
| `data/contributing/contributing` | `doctest_each` glob | 0 → 0
(toctree only) |
| `rllib/getting-started` | `doctest[rllib]` exclude, `doctest[rllib2]`
removed | 15 → 0, by the removal commit |
| `ray-observability/user-guides/cli-sdk` | top-level exclude | 16 → 16
|
| `ray-observability/user-guides/ray-tracing` | top-level exclude | 3 →
3 |
| `train/horovod` | `doctest[train]` exclude | 2 → 2 |
| `train/user-guides/data-loading-preprocessing` | `doctest[train]`
exclude, `doctest[train-gpu]` files | 6 → 6 |
| `train/user-guides/using-accelerators` | `doctest[train]` exclude,
`doctest[train-gpu]` files | 10 → 10 |

To show the check would catch a broken conversion, I mutated each page
with examples three ways: dropping a `testcode` block, altering a line
in one, and turning one into a four-backtick fence. The last renders
fine but is never collected. The check failed on all 24 mutations.

### Rendering changes

I ran `render_diff.py` on all 11 pages against `/en/master`. Six render
identically: `nested-tasks`, `data/contributing/contributing`,
`cli-sdk`, `ray-tracing`, `horovod`, and `using-accelerators`. Every
difference on the other five is listed here.

- `rllib/getting-started`: on master, one `.. testcode::` line had no
blank line after it. docutils read the block's first six lines, the
`best_result = results.get_best_result(...)` call, as the directive's
argument and dropped them. So master shows code that uses `best_result`
without showing where it comes from. The converted page renders all six
lines. This is the one place the conversion deliberately doesn't
reproduce master.
- `rllib/getting-started`: the "Farama gymnasium" link now has
`https://`. On master it's a relative link to `gymnasium.farama.org`
that 404s.
- `ray-core/handling-dependencies`: MyST drops the apostrophe when it
slugifies the "can't import the packages" heading, so the section id
changes. That heading had no label, so the page adds a target carrying
the old docutils slug, and existing `#...-can-t-import-...` links still
resolve. An auto-numbered span id, which nothing links to, also changes
from `id4` to `id2`.
- `data/batch-inference` and
`train/user-guides/data-loading-preprocessing`: each renders an RST
comment as an HTML comment, which readers never see.
- `data/transforming-data`: the "When using" definition list's `<dl>`
gains the unstyled `myst` class.

The first preview diff also caught three regressions that the green
build didn't. MyST's `replacements` extension turned two `(c)` list
markers into `©` and an `etc..` into `etc…`. The anchor above had
changed too. A follow-up commit fixes all three. A sweep of the 11 pages
found no other text that extension rewrites.

### Dead `doc/BUILD.bazel` excludes

A final commit drops four `exclude` entries that name files that have
moved: two in `doctest[serve]` and two in the serve `doc_code` test. A
glob exclude naming a missing file excludes nothing, so these had
silently stopped applying. This doesn't change what any target runs.
#66462 carries the same commit, along with a lint check that fails on
this class of stale path, so the two PRs merge cleanly in either order.

### Open PRs that edit these files

Each of these open PRs edits one of the converted `.rst` files, so each
will need to move its change to the `.md`: #66279, #66191, #65956,
#65933, and #65830 (`handling-dependencies`), #65693 (`cli-sdk`), and
#66419, #66420, #66422, and #66423 (`data/batch-inference`,
`train/user-guides/data-loading-preprocessing`). #66096, #64053, and
#63881 also edit `doc/BUILD.bazel`, and only #66096 edits nearby lines.

## Related issue number

None. No open PR converts these pages. I checked `gh pr list` for open
PRs touching each file.

## Checks

- [x] I've signed off every commit (`git commit -s`).
- [x] Pre-commit hooks passed on every commit.
- Doctest parity: `python3 doctest_parity.py <the 11 .md files>` with
`pytest==7.4.4` and `pytest-sphinx @
git+https://github.com/ray-project/pytest-sphinx`. All OK, run again
after the soft-wrap commit.
- Static checks on every `.md`: fences balance, no leftover RST roles or
directives, every label from the `.rst` is present, and directive counts
match.
- Read the Docs preview builds green under `fail_on_warning`, and the
render diff against `/en/master` is in Rendering changes. The first
build hit the known autosummary-import segfault and passed on rebuild.
- Local doctest run: not done. The GPU targets need hardware, and the
CPU targets run in this PR's premerge because of the `BUILD.bazel`
change.

AI assistance (Claude Code) was used for the conversion and the
verification scripts.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: Douglas Strodtman <[email protected]>
Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
…ervability pages to MyST (ray-project#66461)

## Why are these changes needed?

Converts the last non-API-reference RST pages under `ray-core/`,
`data/`, and `rllib/` to MyST Markdown, plus the `train/` and
`ray-observability/` pages that `doc/BUILD.bazel` names by path. The API
reference trees (`*/api/`, `rllib/package_ref/`, and
`ray-core/compiled-graph/compiled-graph-api`) stay RST for now.

Each page gets its own commit, so you can review one file at a time.
Every commit renames the page's literal `.rst` paths in
`doc/BUILD.bazel` to `.md`. These paths are in `exclude` lists and in
the explicit `files` lists of `doctest[data-gpu]` and
`doctest[train-gpu]`, and they don't glob. Without the edit, an excluded
page would silently join its target once it's `.md`, and an included
page would silently drop out of it.

Conversions are format-only: labels, headings, and prose are unchanged.
A final whitespace-only commit soft-wraps the prose. `ray-soft-wrap`'s
`verify.py` confirms non-whitespace bytes, rendered HTML, and
idempotence for all 11 files.

### `rllib/getting-started`: doctest target removed

The first commit deletes `doctest[rllib2]`, the only target over
`rllib/getting-started.rst`, before the page converts. The target is
tagged `manual` with a hang TODO, so no premerge or postmerge step has
run it, and nothing else references it (`git grep rllib2` is empty). Its
15 `testcode` blocks had no `testoutput`, so they asserted nothing. The
12 visible blocks become display-only `python` code blocks. The three
`:hide:` blocks held `.stop()` cleanups that never rendered, so they're
deleted. `doctest[rllib]` still excludes the page. If these examples
should be validated later, a `doc_code/` script is the better route than
reviving the hanging target. cc @elliot-barn, who owns the TODO.

This commit isn't buildable on its own. It turns a `.. testcode::` that
had no blank line before its body into a `.. code-block:: python`, still
with no blank line, and docutils reads the body as extra arguments to
the directive. The later conversion commit fixes it in the `.md`, and a
squash merge never puts the intermediate commit on master.

### Doctest coverage

Docs-only PRs don't run doctests premerge. This PR edits
`doc/BUILD.bazel`, so every library's docs example step runs, but
premerge can't show the conversion kept the same blocks. For that, I
parsed each `.md` and the `.rst` it replaced with Ray's `pytest-sphinx`
fork, the same parser the doctest macro runs, and asserted identical
sections (directive, body, `:options:`, `:skipif:`) and examples.

| Page | BUILD role | Examples before → after |
| --- | --- | --- |
| `ray-core/handling-dependencies` | `doctest[core]` exclude | 17 → 17 |
| `ray-core/tasks/nested-tasks` | `doctest[core]` exclude | 0 → 0
(`literalinclude` of a tested `doc_code/` file) |
| `data/batch-inference` | `doctest_each` exclude, `doctest[data-gpu]`
files | 7 → 7 |
| `data/transforming-data` | `doctest_each` exclude, `doctest[data-gpu]`
files | 24 → 24 |
| `data/contributing/contributing` | `doctest_each` glob | 0 → 0
(toctree only) |
| `rllib/getting-started` | `doctest[rllib]` exclude, `doctest[rllib2]`
removed | 15 → 0, by the removal commit |
| `ray-observability/user-guides/cli-sdk` | top-level exclude | 16 → 16
|
| `ray-observability/user-guides/ray-tracing` | top-level exclude | 3 →
3 |
| `train/horovod` | `doctest[train]` exclude | 2 → 2 |
| `train/user-guides/data-loading-preprocessing` | `doctest[train]`
exclude, `doctest[train-gpu]` files | 6 → 6 |
| `train/user-guides/using-accelerators` | `doctest[train]` exclude,
`doctest[train-gpu]` files | 10 → 10 |

To show the check would catch a broken conversion, I mutated each page
with examples three ways: dropping a `testcode` block, altering a line
in one, and turning one into a four-backtick fence. The last renders
fine but is never collected. The check failed on all 24 mutations.

### Rendering changes

I ran `render_diff.py` on all 11 pages against `/en/master`. Six render
identically: `nested-tasks`, `data/contributing/contributing`,
`cli-sdk`, `ray-tracing`, `horovod`, and `using-accelerators`. Every
difference on the other five is listed here.

- `rllib/getting-started`: on master, one `.. testcode::` line had no
blank line after it. docutils read the block's first six lines, the
`best_result = results.get_best_result(...)` call, as the directive's
argument and dropped them. So master shows code that uses `best_result`
without showing where it comes from. The converted page renders all six
lines. This is the one place the conversion deliberately doesn't
reproduce master.
- `rllib/getting-started`: the "Farama gymnasium" link now has
`https://`. On master it's a relative link to `gymnasium.farama.org`
that 404s.
- `ray-core/handling-dependencies`: MyST drops the apostrophe when it
slugifies the "can't import the packages" heading, so the section id
changes. That heading had no label, so the page adds a target carrying
the old docutils slug, and existing `#...-can-t-import-...` links still
resolve. An auto-numbered span id, which nothing links to, also changes
from `id4` to `id2`.
- `data/batch-inference` and
`train/user-guides/data-loading-preprocessing`: each renders an RST
comment as an HTML comment, which readers never see.
- `data/transforming-data`: the "When using" definition list's `<dl>`
gains the unstyled `myst` class.

The first preview diff also caught three regressions that the green
build didn't. MyST's `replacements` extension turned two `(c)` list
markers into `©` and an `etc..` into `etc…`. The anchor above had
changed too. A follow-up commit fixes all three. A sweep of the 11 pages
found no other text that extension rewrites.

### Dead `doc/BUILD.bazel` excludes

A final commit drops four `exclude` entries that name files that have
moved: two in `doctest[serve]` and two in the serve `doc_code` test. A
glob exclude naming a missing file excludes nothing, so these had
silently stopped applying. This doesn't change what any target runs.
ray-project#66462 carries the same commit, along with a lint check that fails on
this class of stale path, so the two PRs merge cleanly in either order.

### Open PRs that edit these files

Each of these open PRs edits one of the converted `.rst` files, so each
will need to move its change to the `.md`: ray-project#66279, ray-project#66191, ray-project#65956,
ray-project#65933, and ray-project#65830 (`handling-dependencies`), ray-project#65693 (`cli-sdk`), and
ray-project#66419, ray-project#66420, ray-project#66422, and ray-project#66423 (`data/batch-inference`,
`train/user-guides/data-loading-preprocessing`). ray-project#66096, ray-project#64053, and
ray-project#63881 also edit `doc/BUILD.bazel`, and only ray-project#66096 edits nearby lines.

## Related issue number

None. No open PR converts these pages. I checked `gh pr list` for open
PRs touching each file.

## Checks

- [x] I've signed off every commit (`git commit -s`).
- [x] Pre-commit hooks passed on every commit.
- Doctest parity: `python3 doctest_parity.py <the 11 .md files>` with
`pytest==7.4.4` and `pytest-sphinx @
git+https://github.com/ray-project/pytest-sphinx`. All OK, run again
after the soft-wrap commit.
- Static checks on every `.md`: fences balance, no leftover RST roles or
directives, every label from the `.rst` is present, and directive counts
match.
- Read the Docs preview builds green under `fail_on_warning`, and the
render diff against `/en/master` is in Rendering changes. The first
build hit the known autosummary-import segfault and passed on rebuild.
- Local doctest run: not done. The GPU targets need hardware, and the
CPU targets run in this PR's premerge because of the `BUILD.bazel`
change.

AI assistance (Claude Code) was used for the conversion and the
verification scripts.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: Douglas Strodtman <[email protected]>
Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had
any activity for 14 days. It will be closed in another 14 days if no further activity occurs.
Thank you for your contributions.

You can always ask for help on our discussion forum or Ray's public slack channel.

If you'd like to keep this open, just leave any comment, and the stale label will be removed.

@github-actions github-actions Bot added the stale The issue is stale. It will be closed within 7 days unless there are further conversation label Oct 9, 2026
@MortalHappiness MortalHappiness added unstale A PR that has been marked unstale. It will not get marked stale again if this label is on it. and removed stale The issue is stale. It will be closed within 7 days unless there are further conversation labels Oct 9, 2026
HttpFS gateways commonly serve SPNEGO over plain HTTP (for example
http://host:14000/webhdfs/...), but the Kerberos gate only armed for
https URLs, so an allowlisted HTTP host fell through to an
unauthenticated 401. Arm the gate for any allowlisted http or https
host; the host list remains the only opt-in. Document that plain HTTP
authenticates the gateway without encrypting or integrity-protecting
the download, and that HTTPS is preferred.

Update the unit suite for the inverted scheme semantics: parametrize
the configured-host and missing-dependency tests over both schemes,
drop the cases that asserted HTTP never authenticates, pin the
port-suffixed allowlist entry as a non-match, and add a plain-HTTP
download against a local server.

Signed-off-by: OneSizeFitsQuorum <[email protected]>
@OneSizeFitsQuorum
OneSizeFitsQuorum requested a review from a team as a code owner October 9, 2026 12:55
The wheels.astral.sh mirror (the PEP 503 index for torch-scatter cpu and
cu12.8 builds) replaced the 2.1.2+cpu.torch.2.9 and 2.1.2+cu.12.8.torch.2.9
wheel sets: every previously locked sha256 is no longer served, and the
mirror now hosts 8 wheels per variant. As a result every wanda image
build failed uv hash verification ("Hash mismatch for torch-scatter")
before any test job could start, on this PR and on master alike.

Refresh the --hash blocks to the 8 current wheels per variant, matching
what uv 0.9.26 emits for these pins: values verified against the
mirror's published sha256 list and against the computed hash in the CI
failure (da10d863...). torch-sparse wheels from data.pyg.org were
re-hashed locally and are unchanged, so no other block moves.

Signed-off-by: OneSizeFitsQuorum <[email protected]>
Resolve torch-scatter lock conflicts with master, which already includes the Torch 2.10 upgrade and wheel hash refresh. Move the Kerberos package download documentation into the upstream MyST page. The net PR diff now contains only the Kerberos implementation, tests, and documentation.

Signed-off-by: OneSizeFitsQuorum <[email protected]>
@OneSizeFitsQuorum OneSizeFitsQuorum changed the title [Core][runtime_env] Support Kerberos-authenticated HTTPS package downloads [Core][runtime_env] Support Kerberos-authenticated HTTP/HTTPS package downloads Oct 10, 2026
Sparks0219 pushed a commit that referenced this pull request Oct 20, 2026
## What broke

Since 2.57, `JobSubmissionClient.submit_job()` raises before it uploads
anything when `py_modules` contains an imported module, which the
[runtime_env API
reference](https://docs.ray.io/en/latest/ray-core/handling-dependencies.html#runtime-environments-api-ref)
lists as a supported entry:

```python
import my_module
from ray.job_submission import JobSubmissionClient

client = JobSubmissionClient("http://127.0.0.1:8265")
client.submit_job(entrypoint="python main.py", runtime_env={"py_modules": [my_module]})
```

```
  File ".../ray/dashboard/modules/job/sdk.py", line 221, in submit_job
    runtime_env = copy.deepcopy(runtime_env or {})
TypeError: cannot pickle 'module' object
```

Expected: the module's directory is uploaded and the job runs, as on
2.56.1. A user upgrading from 2.56.1 hit this and is pinned there.

| `py_modules` entry | 2.56.1 | 2.57.0, 2.58.0, master |
|---|---|---|
| module object, Python SDK | works | `TypeError` at submit |
| path string, Python SDK | works | works |
| path string, `ray job submit --runtime-env-json` | works | works |

## Why

#63990 (the fix for #46625) made `submit_job` deep-copy `runtime_env`,
so that uploading stops rewriting the caller's dict with `gcs://` URIs.
Module objects can't be deep-copied, so the copy itself raises. Nothing
in CI passes a module object through `submit_job`, so it went unnoticed.

## The fix

Copy shallowly: `dict(runtime_env or {})`.

- That is enough for #46625. `upload_working_dir_if_needed` and
`upload_py_modules_if_needed` only rebind top-level keys
(`runtime_env["py_modules"] = py_modules_uris`, a new list) and never
mutate a value in place, so the caller's dict and list are left alone.
- A `RuntimeEnv` argument becomes a plain dict before upload and is
rebuilt by the existing `RuntimeEnv(**runtime_env)` right after.
`RuntimeEnv` validation rejects module objects, so only a plain dict can
carry one.

## Not a duplicate

No open issue or PR covers this. The open PRs in the area don't touch
the submission path: #64621 changes CLI stack traces (`cli.py`,
`cli_utils.py`), #66570 changes how nodes install `py_modules` wheels,
and #65933 and #66279 change how nodes download packages. Nothing on
#63990 mentions module objects.

## Testing

`test_submit_job_with_module_object_in_py_modules` runs the real upload
path behind a fake HTTP layer and checks that the module's directory is
zipped with its parent (`my_module/__init__.py`), that the job request
carries a `gcs://` URI, and that the caller's dict still holds the
module. Against the unmodified `sdk.py` it fails with `TypeError: cannot
pickle 'module' object`.

```
$ python -m pytest -v python/ray/dashboard/modules/job/tests/test_sdk.py
110 passed in 141.93s

$ python -m pytest -v python/ray/dashboard/modules/job/tests/test_http_job_server.py
1 failed, 63 passed in 348.11s
```

The one failure, `test_submit_job[conda_yaml]`, times out because conda
isn't installed on the test machine; it times out the same way with the
unmodified `sdk.py`.

End to end on a local cluster, `submit_job(runtime_env={"py_modules":
[my_module]})` now succeeds and the driver imports the module; the same
script raises the `TypeError` with the 2.58.0 wheel. Pre-commit passes
on both changed files.

AI assistance was used for this change.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: Marwan Sarieddine <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
@OneSizeFitsQuorum

Copy link
Copy Markdown
Contributor Author

@MortalHappiness Hi, is there anything I can do to make this pr more mergable?

@MortalHappiness

Copy link
Copy Markdown
Member

I am sorry but I am working on an urgent release blocker this week. I'll review this next week.

Copy link
Copy Markdown
Contributor Author

Hi @MortalHappiness, hope the release blocker is resolved. Just following up—would you have time to review this PR this week? Happy to address any feedback. Thanks!

This branch has not been deployed

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

Labels

community-contribution Contributed by the community core Issues that should be addressed in Ray Core docs An issue or change related to documentation security The issue or proposal related to security unstale A PR that has been marked unstale. It will not get marked stale again if this label is on it.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants