Skip to content

[Refactor][Historyserver] Prefix entity status constants to avoid package-level name conflicts #5237

Description

@markwu7

Search before asking

  • I searched the issues and found no similar issues.

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?

  • Yes I am willing to submit a PR!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions