Search before asking
KubeRay Component
historyserver
Description
While working on the unit tests for historyserver/pkg/eventserver/types/task.go, I noticed the existing TODO in line 69:
Each entity (actor, task, job, node) should have its own const def with entity name prepended to avoid conflicts.
All Ray entity status constants (task, actor, job, and node) are defined in the same Go package, historyserver/pkg/eventserver/types. Since Go does not allow duplicate package-level identifiers, different entities cannot define the same status constant name even if they represent different entity types.
Currently, the naming is inconsistent across entities:
- Task uses unprefixed names such as
RUNNING, FAILED, and FINISHED. (see task.go)
- Job uses prefixed names but without underscore such as
JOBRUNNING, JOBFAILED, and JOBFINISHED (see job.go).
- Actor uses unprefixed names such as
ALIVE and DEAD. (see actor.go)
- Node uses prefixed names such as
NODE_ALIVE and NODE_DEAD, since ALIVE and DEAD are already used by Actor. (see node.go)
This makes the constant naming inconsistent and makes it harder to clearly identify which entity a status belongs to.
Suggested change
Standardize all entity status/state identifiers with an ENTITY_ prefix (aligned with existing NODE_ALIVE / NODE_DEAD).
- Task (
TaskStatus): TASK_NIL, TASK_RUNNING, TASK_FAILED, TASK_FINISHED , …..
- Actor (
StateType): ACTOR_ALIVE, ACTOR_DEAD, ACTOR_PENDING_CREATION , …..
- Job status (
JobStatus): JOB_PENDING, JOB_RUNNING, JOB_FAILED, JOB_SUCCEEDED, JOB_STOPPED
(replace JOBRUNNING / JOBFAILED)
- Job state (
JobState): JOB_UNSPECIFIED, JOB_CREATED, JOB_FINISHED (replace JOBFINISHED)
- Node (
NodeState): keep NODE_ALIVE, NODE_DEAD
This is an internal identifier rename only. Public API JSON values must not change.
Are you willing to submit a PR?
Search before asking
KubeRay Component
historyserver
Description
While working on the unit tests for
historyserver/pkg/eventserver/types/task.go, I noticed the existing TODO in line 69:All Ray entity status constants (
task,actor,job, andnode) are defined in the same Go package,historyserver/pkg/eventserver/types. Since Go does not allow duplicate package-level identifiers, different entities cannot define the same status constant name even if they represent different entity types.Currently, the naming is inconsistent across entities:
RUNNING,FAILED, andFINISHED. (seetask.go)JOBRUNNING,JOBFAILED, andJOBFINISHED(seejob.go).ALIVEandDEAD. (seeactor.go)NODE_ALIVEandNODE_DEAD, sinceALIVEandDEADare already used by Actor. (seenode.go)This makes the constant naming inconsistent and makes it harder to clearly identify which entity a status belongs to.
Suggested change
Standardize all entity status/state identifiers with an
ENTITY_prefix (aligned with existingNODE_ALIVE/NODE_DEAD).TaskStatus):TASK_NIL,TASK_RUNNING,TASK_FAILED,TASK_FINISHED, …..StateType):ACTOR_ALIVE,ACTOR_DEAD,ACTOR_PENDING_CREATION, …..JobStatus):JOB_PENDING,JOB_RUNNING,JOB_FAILED,JOB_SUCCEEDED,JOB_STOPPED(replace
JOBRUNNING/JOBFAILED)JobState):JOB_UNSPECIFIED,JOB_CREATED,JOB_FINISHED(replaceJOBFINISHED)NodeState): keepNODE_ALIVE,NODE_DEADThis is an internal identifier rename only. Public API JSON values must not change.
Are you willing to submit a PR?