Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature][RestAPI] Add overview api #6883

Merged
merged 12 commits into from
Jun 3, 2024
Merged

[Feature][RestAPI] Add overview api #6883

merged 12 commits into from
Jun 3, 2024

Conversation

liugddx
Copy link
Member

@liugddx liugddx commented May 22, 2024

Purpose of this pull request

{
"projectVersion": "2.3.5",
"gitCommitAbbrev": "DeadD0d0",
"totalSlot": "0",
"unassignedSlot": "0",
"runningJobs": "0",
"finishedJobs": "0",
"failedJobs": "0",
"cancelledJobs": "0",
"works": "1"
}

Does this PR introduce any user-facing change?

How was this patch tested?

Check list

@liugddx liugddx marked this pull request as draft May 22, 2024 09:49
@liugddx liugddx marked this pull request as ready for review May 22, 2024 13:25
@liugddx liugddx marked this pull request as draft May 22, 2024 13:25
@liugddx liugddx marked this pull request as ready for review May 27, 2024 15:38
@liugddx liugddx requested a review from Hisoka-X May 28, 2024 14:42
@Hisoka-X Hisoka-X changed the title [feature][restapi] add overview api [Feature][RestAPI] Add overview api May 30, 2024
Copy link
Member

@Hisoka-X Hisoka-X left a comment

Choose a reason for hiding this comment

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

Thanks @liugddx ! I like this feature.

}

@Override
public int workCount() {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
public int workCount() {
public int workerCount() {

@@ -39,7 +39,7 @@ public static void main(String[] args)
clientCommandArgs.setJobName(Paths.get(configFile).getFileName().toString());
// Change Execution Mode to CLUSTER to use client mode, before do this, you should start
// SeaTunnelEngineServerExample
clientCommandArgs.setMasterType(MasterType.LOCAL);
clientCommandArgs.setMasterType(MasterType.CLUSTER);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
clientCommandArgs.setMasterType(MasterType.CLUSTER);
clientCommandArgs.setMasterType(MasterType.LOCAL);

Comment on lines 46 to 76
List<SlotProfile> assignedSlots = resourceManager.getAssignedSlots();

List<SlotProfile> unassignedSlots = resourceManager.getUnassignedSlots();
IMap<Long, JobState> finishedJob =
getNodeEngine().getHazelcastInstance().getMap(Constant.IMAP_FINISHED_JOB_STATE);
overviewInfo.setTotalSlot(assignedSlots.size() + unassignedSlots.size());
overviewInfo.setUnassignedSlot(unassignedSlots.size());
overviewInfo.setRunningJobs(
getNodeEngine()
.getHazelcastInstance()
.getMap(Constant.IMAP_RUNNING_JOB_INFO)
.size());
overviewInfo.setFailedJobs(
finishedJob.values().stream()
.filter(
jobState ->
jobState.getJobStatus()
.name()
.equals(JobStatus.FAILED.toString()))
.count());
overviewInfo.setCancelledJobs(
finishedJob.values().stream()
.filter(
jobState ->
jobState.getJobStatus()
.name()
.equals(JobStatus.CANCELED.toString()))
.count());
overviewInfo.setWorks(resourceManager.workCount());
overviewInfo.setFinishedJobs(
finishedJob.values().stream()
Copy link
Member

Choose a reason for hiding this comment

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

I find this part show up twice. Please do some refactor.

Hisoka-X
Hisoka-X previously approved these changes May 31, 2024
@hailin0
Copy link
Member

hailin0 commented May 31, 2024

Please fix ci error
image

@Hisoka-X Hisoka-X requested a review from hailin0 May 31, 2024 13:04
@Hisoka-X
Copy link
Member

Hisoka-X commented Jun 3, 2024

image

@liugddx liugddx requested a review from Hisoka-X June 3, 2024 07:05
@hailin0 hailin0 merged commit 2cc82bd into apache:dev Jun 3, 2024
6 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.

None yet

3 participants