Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
esseivaju committed Oct 4, 2024
1 parent 56ec25b commit 046646d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
9 changes: 3 additions & 6 deletions src/raythena/actors/esworker.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
DONE: [READY_FOR_JOB],
}


@ray.remote(num_cpus=1, max_restarts=1, max_task_retries=3)
class ESWorker:
"""
Expand Down Expand Up @@ -323,9 +324,7 @@ def transition_state(self, dest: int) -> None:
IllegalWorkerState if the transition isn't allowed
"""
if dest not in self.transitions[self.state]:
self._logger.error(
f"Illegal transition from {STATES_NAME[self.state]} to {STATES_NAME[dest]}"
)
self._logger.error(f"Illegal transition from {STATES_NAME[self.state]} to {STATES_NAME[dest]}")
raise IllegalWorkerState(
worker_id=self.id,
src_state=STATES_NAME[self.state],
Expand Down Expand Up @@ -576,9 +575,7 @@ def get_message(self) -> WorkerResponse:
self.transition_state(STAGE_OUT)
self.stageout()
return self.return_message(Messages.PROCESS_DONE)
elif self.is_event_service_job() and (
self.state == READY_FOR_EVENTS or self.should_request_ranges()
):
elif self.is_event_service_job() and (self.state == READY_FOR_EVENTS or self.should_request_ranges()):
req = EventRangeRequest()
req.add_event_request(
self.job["PandaID"],
Expand Down
1 change: 1 addition & 0 deletions src/raythena/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
},
}


class Config:
"""Class storing app configuration.
Expand Down
2 changes: 1 addition & 1 deletion src/raythena/utils/eventservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -1073,7 +1073,7 @@ class EventRange:
FAILED = "failed"
FATAL = "fatal"
STATES = frozenset([READY, ASSIGNED, DONE, FAILED, FATAL])

def __init__(
self,
event_range_id: str,
Expand Down
13 changes: 7 additions & 6 deletions src/raythena/utils/exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
UNKNOWN = 0

ERROR_CODES_GENRIC_MESSAGES = {
ILLEGAL_WORKER_STATE: "Illegal worker state transition",
STAGEIN_FAILED: "Failed to stagein data",
STAGEOUT_FAILED: "Failed to stageout data",
PAYLOAD_FAILED: "Payload execution failed",
UNKNOWN: "Unknown error",
}
ILLEGAL_WORKER_STATE: "Illegal worker state transition",
STAGEIN_FAILED: "Failed to stagein data",
STAGEOUT_FAILED: "Failed to stageout data",
PAYLOAD_FAILED: "Payload execution failed",
UNKNOWN: "Unknown error",
}


class ErrorCodes:
"""
Expand Down

0 comments on commit 046646d

Please sign in to comment.