Commit be77f0a
[Core] Fix task name inconsistency in RUNNING vs FINISHED metrics (#59893)
## Description
Fix inconsistent task name in metrics between RUNNING and FINISHED
states.
When a Ray task is defined with a custom name via
`.options(name="custom_name")`, the `ray_tasks` metrics show
inconsistent names:
- **RUNNING** state: shows the original function name (e.g., `RemoteFn`)
- **FINISHED/FAILED** state: shows the custom name (e.g., `test`)
**Root cause:** The RUNNING task counter in `CoreWorker` uses
`FunctionDescriptor()->CallString()` to get the task name, while
finished task events correctly use `TaskSpecification::GetName()`.
**Fix:** Changed both `HandlePushTask` and `ExecuteTask` in
`core_worker.cc` to use `task_spec.GetName()` consistently, which
properly returns the custom name when set.
## Related issues
None - this PR addresses a newly discovered bug.
## Additional information
**Files changed:**
- `src/ray/core_worker/core_worker.cc` - Use `GetName()` instead of
`FunctionDescriptor()->CallString()` for metrics
- `python/ray/tests/test_task_metrics.py` - Added test
`test_task_custom_name_metrics` to verify custom names appear correctly
in metrics
Signed-off-by: Yuan Jiewei <jieweihh.yuan@gmail.com>
Co-authored-by: Yuan Jiewei <jieweihh.yuan@gmail.com>1 parent 639c4c5 commit be77f0a
File tree
2 files changed
+62
-5
lines changed- python/ray/tests
- src/ray/core_worker
2 files changed
+62
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
112 | 166 | | |
113 | 167 | | |
114 | 168 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2807 | 2807 | | |
2808 | 2808 | | |
2809 | 2809 | | |
2810 | | - | |
2811 | | - | |
| 2810 | + | |
| 2811 | + | |
| 2812 | + | |
| 2813 | + | |
| 2814 | + | |
2812 | 2815 | | |
2813 | 2816 | | |
2814 | 2817 | | |
| |||
3434 | 3437 | | |
3435 | 3438 | | |
3436 | 3439 | | |
| 3440 | + | |
| 3441 | + | |
3437 | 3442 | | |
3438 | | - | |
3439 | | - | |
3440 | | - | |
| 3443 | + | |
3441 | 3444 | | |
3442 | 3445 | | |
3443 | 3446 | | |
| |||
0 commit comments