code: void finalizeJobStateBeforeCommit() {
      this.jobState.setEndTime(System.currentTimeMillis());
      this.jobState.setDuration(this.jobState.getEndTime() - this.jobState.getStartTime());
  
      for (TaskState taskState : this.jobState.getTaskStates()) {
        // Set fork.branches explicitly here so the rest job flow can pick it up
        this.jobState
            .setProp(ConfigurationKeys.FORK_BRANCHES_KEY, taskState.getPropAsInt(ConfigurationKeys.FORK_BRANCHES_KEY, 1));
      }
    }
docs: Finalize the {@link JobState} before committing the job.