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
under the historyserver directory using ripgrep. The full results are attached in the accompanying .txt file for reference:
hc_paths.txt