Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions release/ray_release/glue.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,18 +535,20 @@ def run_release_test_anyscale(
start_time_unix,
)

# Obtain the cluster info again as it is set after the
# command was run in case of anyscale jobs
result.job_url = runner.job_url()
result.job_id = runner.job_id()
result.last_logs = runner.get_last_logs()

except Exception as e:
logger.exception(e)
buildkite_open_last()
pipeline_exception = e
metrics = {}

# Obtain the cluster info again as it is set after the
# command was run in case of anyscale jobs
if runner:
result.job_url = runner.job_url()
result.job_id = runner.job_id()
if result.job_id:
result.last_logs = runner.get_last_logs()
Comment on lines +547 to +550
Copy link
Contributor

Choose a reason for hiding this comment

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

high

While moving this logic out of the main try block is a good idea to ensure job details are captured on failure, this new block is not protected by a try...except. If any of the runner methods (job_url(), job_id(), or get_last_logs()) raise an exception, it will be unhandled and crash the program. This would prevent any further cleanup or reporting. It's safer to wrap this in its own try...except block to gracefully handle potential errors during job info retrieval.

Suggested change
result.job_url = runner.job_url()
result.job_id = runner.job_id()
if result.job_id:
result.last_logs = runner.get_last_logs()
try:
result.job_url = runner.job_url()
result.job_id = runner.job_id()
if result.job_id:
result.last_logs = runner.get_last_logs()
except Exception as e:
logger.warning(f'Failed to get job info from runner: {e}')


reset_signal_handling()

time_taken = time.monotonic() - start_time
Expand Down
5 changes: 5 additions & 0 deletions release/ray_release/tests/test_glue.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,9 @@ def _succeed_until(self, until: str):

self.command_runner_return["run_prepare_command"] = None

self.command_runner_return["job_url"] = "http://mock-job-url"
self.command_runner_return["job_id"] = "mock-job-id"

if until == "prepare_command":
return

Expand Down Expand Up @@ -318,6 +321,7 @@ def testPrepareCommandFails(self):
# Special case: Prepare commands are usually waiting for nodes
# (this may change in the future!)
self.assertEqual(result.return_code, ExitCode.CLUSTER_WAIT_TIMEOUT.value)
self.assertIsNone(result.job_url)

def testTestCommandFails(self):
result = Result()
Expand All @@ -335,6 +339,7 @@ def testTestCommandFails(self):
with self.assertRaises(TestCommandTimeout):
self._run(result)
self.assertEqual(result.return_code, ExitCode.COMMAND_TIMEOUT.value)
self.assertIsNotNone(result.job_url)

def testTestCommandTimeoutLongRunning(self):
result = Result()
Expand Down