close
Skip to content

[Feature][Core] Add PendingJobs info in the response of GetOverviewOperation#9902

Merged
davidzollo merged 9 commits into
apache:devfrom
TongchengOpenSource:feature/overview-pendingjobs
Nov 3, 2025
Merged

[Feature][Core] Add PendingJobs info in the response of GetOverviewOperation#9902
davidzollo merged 9 commits into
apache:devfrom
TongchengOpenSource:feature/overview-pendingjobs

Conversation

@xiaochen-zhou

Copy link
Copy Markdown
Contributor

Purpose of this pull request

Add PendingJobs info in the response of GetOverviewOperation

Does this PR introduce any user-facing change?

How was this patch tested?

Check list

Comment on lines +92 to +93
overviewInfo.setPendingJobs(
server.getCoordinatorService().getJobCountMetrics().getPendingJobCount());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about creating a method in CoordinatorService that directly returns only the pendingJobCount instead of using the getJobCountMetrics method?

@Hisoka-X Hisoka-X Sep 26, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • the constructor method of the JobHistoryService
jobHistoryService =
                new JobHistoryService(
                        nodeEngine,
                        runningJobStateIMap,
                        logger,
                        pendingJobQueue.getJobIdMap(),
                        runningJobMasterMap,
                        nodeEngine.getHazelcastInstance().getMap(Constant.IMAP_FINISHED_JOB_STATE),
                        nodeEngine
                                .getHazelcastInstance()
                                .getMap(Constant.IMAP_FINISHED_JOB_METRICS),
                        nodeEngine
                                .getHazelcastInstance()
                                .getMap(Constant.IMAP_FINISHED_JOB_VERTEX_INFO),
                        engineConfig.getHistoryJobExpireMinutes());
  • the getJobStatusData method of JobHistoryService
public List<JobStatusData> getJobStatusData() {
        List<JobStatusData> status = new ArrayList<>();
        final List<JobState> runningJobStateList =
                runningJobMasterMap.values().stream()
                        .map(master -> toJobStateMapper(master, true))
                        .collect(Collectors.toList());
        Set<Long> runningJonIds =
                runningJobStateList.stream().map(JobState::getJobId).collect(Collectors.toSet());

        List<JobState> pendingJobStateList =
                pendingJobInfoMap.entrySet().stream()
                        .map(
                                entry -> {
                                    Long jobId = entry.getKey();
                                    JobImmutableInformation jobImmutableInformation =
                                            entry.getValue()
                                                    .getJobMaster()
                                                    .getJobImmutableInformation();
                                    return new JobState(
                                            jobId,
                                            jobImmutableInformation.getJobName(),
                                            JobStatus.PENDING,
                                            jobImmutableInformation.getCreateTime(),
                                            null,
                                            null,
                                            null,
                                            null);
                                })
                        .collect(Collectors.toList());
....

jobIdMap has been assigned to pendingJobInfoMap of the JobHistoryService

@dybyte dybyte Sep 28, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion, the getJobStatusData() and getJobCountMetrics() methods perform a lot of extra work that isn’t needed if we only want to get the pendingJobCount.

@dybyte dybyte left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM if CI passes.

@xiaochen-zhou

Copy link
Copy Markdown
Contributor Author

Done. @Hisoka-X @dybyte @hawk9821

@Hisoka-X Hisoka-X left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @xiaochen-zhou .

@davidzollo davidzollo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@davidzollo davidzollo merged commit 24bdbca into apache:dev Nov 3, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants