Skip to content

[Refactor] [history server] Replace all hardcoded root temporary paths with path constants #4420

@JiangJiaWei1103

Description

@JiangJiaWei1103

Currently, #4417 addresses hardcoded file paths by switching to filepath. However, the underlying issue is that there are still multiple hardcoded paths related to the default temporary root directory (/tmp/ray) scattered across the history server project.

A more robust and maintainable approach might be to introduce centralized path constants (in utils/constant.go) and replace all hardcoded occurrences accordingly. For example:

  • TmpRayRoot: /tmp/ray
  • RayPrevLogsPath: filepath.Join(TmpRayRoot, "prev-logs")
  • RayPersistCompletePath: filepath.Join(TmpRayRoot, "persist-complete-logs")
  • RaySessionLatestPath: filepath.Join(TmpRayRoot, "session_latest")
  • RayNodeIDPath: filepath.Join(TmpRayRoot, "raylet_node_id")

This would help ensure consistency and make future changes easier if the default root path needs to be adjusted.

To identify all existing hardcoded paths, I ran

rg /tmp/ray .

under the historyserver directory using ripgrep. The full results are attached in the accompanying .txt file for reference:
hc_paths.txt

Metadata

Metadata

Assignees

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