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

   ### What changes were proposed in this pull request?
   
   - Update `onJobEnd` method of `AppStatusListener`, removing the logic of 
reducing `job.activeStages` for each pending stage.
   - Add UT to verify whether `numActiveStages` of jobs data is correct.
   
   ### Why are the changes needed?
   
   For property `activeStages` of `LiveJob`, it is updated when:
   - A job is started: `activeStages = 0`
   - A stage is submitted: `activeStages += 1`
   - A stage is completed: `activeStages -= 1`
   - A job is ended: `activeStages -= 1` for each pending stages
   
   According to the implementation of `AppStatusListener` and `LiveStage`:
   - When a job is created, all of its stages in job info will be created with 
state set to pending without updating `activeStages`.
   - When a stage is submitted, its state will be immediately set to active 
with `activeStages` increased by `1`.
   
   So for pending stages, they won't affect `activeStages`. Therefore, when job 
is ended, `activeStages` shouldn't be decreased by `1` for each pending stage.
   
   Here's an example:
   - Job 0 starts with stage 0, 1, 2
   - Stage 0 submitted
   - Stage 0 completed
   - Job 0 ends
   
   In this case, when job 0 ends, its `numActiveStages` will be `-2`, which is 
obviously incorrect.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No.
   
   ### How was this patch tested?
   
   This PR adds a UT of the example mentioned above, to make sure 
`numActiveStages` should be `0` instead of `-2`.


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