abhinavgautam01 opened a new pull request, #1693:
URL: https://github.com/apache/datafusion-ballista/pull/1693

   # Which issue does this PR close?
   <!--
   We generally require a GitHub issue to be filed for all bug fixes and 
enhancements and this helps us generate change logs for our releases. You can 
link an issue to this PR using the GitHub syntax. For example `Closes #123` 
indicates that this PR will close issue #123.
   -->
   Closes #1689
    # Rationale for this change
   <!--
    Why are you proposing this change? If this is already explained clearly in 
the issue then this section is not needed.
    Explaining clearly why changes are proposed helps reviewers understand your 
changes and offer better suggestions for fixes.
   -->
   The REST job list and job-detail handlers computed elapsed time as `end_time 
- start_time` with `u64`. If `end_time` is before `start_time` (for example 
`end_time` is still `0` while `start_time` is set, or other inconsistent 
timestamps on failed jobs), the subtraction underflows and the scheduler API 
can panic with `attempt to subtract with overflow`. Saturating subtraction 
matches how we already treat inconsistent timestamps elsewhere in the same 
module and avoids the panic.
   # What changes are included in this PR?
   <!--
   There is no need to duplicate the description in the issue here but it is 
sometimes worth providing a summary of the individual changes in this PR.
   -->
   - Add `job_elapsed_ms(start_time, end_time)` using 
`end_time.saturating_sub(start_time)`.
   - Use it in `get_jobs` and `get_job` when calling `format_job_status`.
   - Add unit tests for normal duration and `end_time < start_time`.
   # Are there any user-facing changes?
   <!--
   If there are user-facing changes then we may require documentation to be 
updated before approving the PR.
   -->
   Yes, but only in the sense of **bug fix behavior**: the jobs REST API should 
no longer panic when listing or fetching a job whose stored timestamps are 
inconsistent; elapsed duration used in status text is clamped to **0 ms** when 
`end_time < start_time` instead of crashing.
   <!--
   If there are any breaking changes to public APIs, please add the `api 
change` label.
   -->
   <!-- No breaking API changes; no `api change` label. -->


-- 
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