Skip to content

[release test] collapse into AnyscaleJobRunner in glue.py#60267

Merged
aslonnie merged 2 commits intoray-project:masterfrom
anyscale:lonnie-260117-jobrunner
Jan 20, 2026
Merged

[release test] collapse into AnyscaleJobRunner in glue.py#60267
aslonnie merged 2 commits intoray-project:masterfrom
anyscale:lonnie-260117-jobrunner

Conversation

@aslonnie
Copy link
Collaborator

it is always an instance of AnyscaleJobRunner.

@aslonnie aslonnie requested a review from a team as a code owner January 18, 2026 07:29
Copy link
Contributor

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

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 refactors the code to use AnyscaleJobRunner directly instead of the more generic CommandRunner, which simplifies the logic by removing several type checks. The changes are generally good and improve code clarity.

However, I've found a critical issue where removing one of the checks without replacing it with a null-check can lead to an AttributeError if the runner object is None. This could happen during error handling and would shadow the original exception. I've provided a suggestion to fix this.

Additionally, I've pointed out a newly added isinstance check that appears to be redundant given the function's type hints and logic, suggesting an alternative if an assertion is desired.

Comment on lines 559 to 561
result.job_url = runner.job_manager.job_url
result.job_id = runner.job_manager.job_id
result.last_logs = runner.get_last_logs() if runner else None
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

These assignments are not safe if runner is None. This can happen if an exception is raised before runner is assigned in the try block. Accessing runner.job_manager would then raise an AttributeError, shadowing the original, more informative exception. You should guard these assignments.

Suggested change
result.job_url = runner.job_manager.job_url
result.job_id = runner.job_manager.job_id
result.last_logs = runner.get_last_logs() if runner else None
result.job_url = runner.job_manager.job_url if runner else None
result.job_id = runner.job_manager.job_id if runner else None
result.last_logs = runner.get_last_logs() if runner else None

Comment on lines 141 to 142
if not isinstance(command_runner, AnyscaleJobRunner):
raise ReleaseTestSetupError(f"Command runner is not an AnyscaleJobRunner")
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This isinstance check seems redundant. The function's return type hint already specifies AnyscaleJobRunner, and the logic within this function ensures that command_runner is an instance of AnyscaleJobRunner. If the goal is to assert this, an assert isinstance(command_runner, AnyscaleJobRunner) would be more idiomatic for an internal check that should always pass. Raising ReleaseTestSetupError suggests this is a user-configurable error, which doesn't seem to be the case here.

cursor[bot]

This comment was marked as outdated.

@aslonnie aslonnie force-pushed the lonnie-260117-jobrunner branch from 16205f1 to 56e7a1d Compare January 18, 2026 07:36
@aslonnie aslonnie added the go add ONLY when ready to merge, run all tests label Jan 18, 2026
@aslonnie aslonnie force-pushed the lonnie-260117-jobrunner branch from 56e7a1d to 8877289 Compare January 18, 2026 08:14
@ray-gardener ray-gardener bot added core Issues that should be addressed in Ray Core devprod release-test release test labels Jan 18, 2026
Copy link
Contributor

@andrew-anyscale andrew-anyscale left a comment

Choose a reason for hiding this comment

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

This could happen because we wrap the above init in a try/catch. https://github.com/ray-project/ray/pull/60267/files#diff-542132be3c6f0d88893d58435c5460eb5ec1a28999b98d30a87e8e8856e26965R551-R555

What should the outcome be if _load_test_configuration fails?

it is always an instance of AnyscaleJobRunner.

Signed-off-by: Lonnie Liu <95255098+aslonnie@users.noreply.github.com>
@aslonnie aslonnie force-pushed the lonnie-260117-jobrunner branch from 8877289 to 82ceacc Compare January 20, 2026 18:54
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

# command was run in case of anyscale jobs
result.job_url = runner.job_manager.job_url
result.job_id = runner.job_manager.job_id
result.last_logs = runner.get_last_logs()
Copy link

Choose a reason for hiding this comment

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

Diagnostic info lost when test execution fails

High Severity

Moving the code that sets result.job_url, result.job_id, and result.last_logs inside the try block means these diagnostic values won't be captured when an exception occurs during test execution. Previously, this code ran unconditionally after the try-except, ensuring job info and logs were available for debugging failed tests. Now, when tests fail (the most critical scenario for debugging), last_logs falls back to just the exception traceback instead of actual job logs, and job_url/job_id are not set at all.

Fix in Cursor Fix in Web

@aslonnie
Copy link
Collaborator Author

This could happen because we wrap the above init in a try/catch. https://github.com/ray-project/ray/pull/60267/files#diff-542132be3c6f0d88893d58435c5460eb5ec1a28999b98d30a87e8e8856e26965R551-R555

What should the outcome be if _load_test_configuration fails?

moved into the try block.

@aslonnie aslonnie merged commit 4311242 into ray-project:master Jan 20, 2026
5 of 6 checks passed
jinbum-kim pushed a commit to jinbum-kim/ray that referenced this pull request Jan 29, 2026
…t#60267)

it is always an instance of AnyscaleJobRunner.

Signed-off-by: Lonnie Liu <95255098+aslonnie@users.noreply.github.com>
Signed-off-by: jinbum-kim <jinbum9958@gmail.com>
400Ping pushed a commit to 400Ping/ray that referenced this pull request Feb 1, 2026
…t#60267)

it is always an instance of AnyscaleJobRunner.

Signed-off-by: Lonnie Liu <95255098+aslonnie@users.noreply.github.com>
Signed-off-by: 400Ping <jiekaichang@apache.org>
ryanaoleary pushed a commit to ryanaoleary/ray that referenced this pull request Feb 3, 2026
…t#60267)

it is always an instance of AnyscaleJobRunner.

Signed-off-by: Lonnie Liu <95255098+aslonnie@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Issues that should be addressed in Ray Core devprod go add ONLY when ready to merge, run all tests release-test release test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants