Spenserrrr opened a new pull request, #60708:
URL: https://github.com/apache/spark/pull/60708

   ### What changes were proposed in this pull request?
   
   - The Python worker reports its timestamps and durations in microseconds 
instead of milliseconds: `bootTimestampUs`, `initTimestampUs`, 
`finishTimestampUs`, `pythonExecutionDurationUs` and each detailed phase as 
`<phase>Us`. Durations are still accumulated in nanoseconds and converted once 
per task; the timer API used by eval type handlers is unchanged.
   - The JVM requires the microsecond fields and computes the boot, 
initialization and total times from a microsecond runner start time.
   - The nine Python timing SQL metrics become microsecond sums with the unit 
in their keys and names, so values in different units are never stored under 
one name: `pythonBootTimeUs` ("time to start Python workers (us)"), 
`pythonInitTimeUs`, `pythonTotalTimeUs`, `pythonProcessingTimeUs`, and the five 
detailed phase metrics such as `pythonUDFExecutionTimeUs` ("time to evaluate 
Python UDFs (us)"). Spark has no microsecond timing metric type, so they are 
sum metrics, like the existing "time to collect (ms)".
   - The executor log line still reports these times in milliseconds.
   
   This overlaps with the open #59892 (detailed timing for mapInPandas) in 
`PythonSQLMetrics.scala`, `worker_metrics.py` and the phase metric tests; 
whichever merges second will be rebased onto the other.
   
   ### Why are the changes needed?
   
   Python worker timings are floored to whole milliseconds per task, so fast 
work reports 0: a phase that takes 600 µs reports 0 ms, and sums over many 
tasks undercount.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. The nine Python timing SQL metrics are renamed to `...Us` keys and "... 
(us)" names, including the released `pythonBootTime`, `pythonInitTime`, 
`pythonTotalTime` (since 4.0) and `pythonProcessingTime` (since 4.2), and the 
SQL UI shows each as a single microsecond total instead of a formatted total 
with min, median and max. A timing that is 0 in every task, such as boot time 
with reused workers, is no longer recorded in event logs.
   
   ### How was this patch tested?
   
   `WorkerMetricsTests`, `test_metrics_report_uses_microseconds`, 
`test_phase_timing_boundaries`, `test_phase_metrics` and the `PythonUDFSuite` 
timing tests fail without this change; local probes checked the SQL UI strings, 
the executor log units and the event log.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Claude Opus 5.5)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to