Skip to content

Commit 3862945

Browse files
aslonnieclaude
andcommitted
[Release] Remove -4 job state handling and move -1 check to top
Remove the FAILED-before-running (-4) special case from _handle_command_output. Move the FAILED (-1) check to the top of the function alongside the UNKNOWN (-2) check. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 6d39d04 commit 3862945

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

release/ray_release/command_runner/anyscale_job_runner.py

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
JobBrokenError,
1919
JobNoLogsError,
2020
JobOutOfRetriesError,
21-
JobTerminatedBeforeStartError,
2221
LogsError,
2322
PrepareCommandError,
2423
PrepareCommandTimeout,
@@ -158,16 +157,15 @@ def wait_for_nodes(self, num_nodes: int, timeout: float = 900):
158157
)
159158

160159
def _handle_command_output(self, job_state: int, raise_on_timeout: bool = True):
160+
if job_state == -1:
161+
raise JobOutOfRetriesError(
162+
"Job returned non-success state: 'FAILED' "
163+
"(command has not been ran or no logs could have been obtained)."
164+
)
165+
161166
if job_state == -2:
162167
raise JobBrokenError("Job state is 'UNKNOWN'.")
163168

164-
if job_state == -4:
165-
raise JobTerminatedBeforeStartError(
166-
"Job entered 'FAILED' state before it started "
167-
"(most likely due to inability to provision required nodes; "
168-
"otherwise it was terminated manually or Ray was stopped)."
169-
)
170-
171169
# First try to obtain the output.json from S3.
172170
# If that fails, try logs.
173171
try:
@@ -222,12 +220,6 @@ def _handle_command_output(self, job_state: int, raise_on_timeout: bool = True):
222220
f"Command returned non-success status: {workload_status_code}."
223221
)
224222

225-
if job_state == -1:
226-
raise JobOutOfRetriesError(
227-
"Job returned non-success state: 'FAILED' "
228-
"(command has not been ran or no logs could have been obtained)."
229-
)
230-
231223
def _get_full_command_env(self, env: Optional[Dict[str, str]] = None):
232224
full_env = {
233225
"TEST_OUTPUT_JSON": self._RESULT_OUTPUT_JSON,

0 commit comments

Comments
 (0)