Skip to content

Commit

Permalink
merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
BBesrour committed Dec 1, 2024
1 parent 9a2063f commit 3037731
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ public BuildJobQueueItem(BuildJobQueueItem queueItem, ResultDTO submissionResult

public BuildJobQueueItem(BuildJobQueueItem queueItem, BuildAgentDTO buildAgent, int newRetryCount) {
this(queueItem.id(), queueItem.name(), buildAgent, queueItem.participationId(), queueItem.courseId(), queueItem.exerciseId(), newRetryCount, queueItem.priority(), null,
queueItem.repositoryInfo(), new JobTimingInfo(queueItem.jobTimingInfo.submissionDate(), ZonedDateTime.now(), null), queueItem.buildConfig(), null);
queueItem.repositoryInfo(),
new JobTimingInfo(queueItem.jobTimingInfo.submissionDate(), ZonedDateTime.now(), null, null, queueItem.jobTimingInfo().estimatedDuration()),
queueItem.buildConfig(), null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -352,11 +352,11 @@ public ZonedDateTime getBuildJobEstimatedQueueDuration(long participationId) {
return ZonedDateTime.now();
}

List<BuildJobQueueItem> jobsQueuedBefore = queue.stream().sorted(new LocalCIPriorityQueueComparator()).takeWhile(job -> !job.id().equals(buildJobId)).toList();
List<BuildJobQueueItem> jobsQueuedBefore = getQueuedJobs().stream().sorted(new LocalCIPriorityQueueComparator()).takeWhile(job -> !job.id().equals(buildJobId)).toList();

ZonedDateTime now = ZonedDateTime.now();

List<Long> agentsAvailabilities = new ArrayList<>(processingJobs.values().stream().map(job -> buildJobRemainingDuration(job, now)).sorted().toList());
List<Long> agentsAvailabilities = new ArrayList<>(getQueuedJobs().stream().map(job -> buildJobRemainingDuration(job, now)).sorted().toList());

if (agentsAvailabilities.size() < this.buildAgentsCapacity) {
int agentsToAdd = this.buildAgentsCapacity - agentsAvailabilities.size();
Expand All @@ -377,7 +377,7 @@ public ZonedDateTime getBuildJobEstimatedQueueDuration(long participationId) {
}

private String getIdOfQueuedJobFromParticipation(long participationId) {
var participationBuildJobIds = queue.stream().filter(job -> job.participationId() == participationId).map(BuildJobQueueItem::id).toList();
var participationBuildJobIds = getQueuedJobs().stream().filter(job -> job.participationId() == participationId).map(BuildJobQueueItem::id).toList();
if (participationBuildJobIds.isEmpty()) {
return null;
}
Expand Down Expand Up @@ -431,8 +431,8 @@ public void entryUpdated(com.hazelcast.core.EntryEvent<String, BuildAgentInforma
}

private void getBuildAgentsCapacity() {
buildAgentsCapacity = buildAgentInformation.values().stream().mapToInt(BuildAgentInformation::maxNumberOfConcurrentBuildJobs).sum();
runningBuildJobCount = buildAgentInformation.values().stream().mapToInt(BuildAgentInformation::numberOfCurrentBuildJobs).sum();
buildAgentsCapacity = getBuildAgentInformation().stream().mapToInt(BuildAgentInformation::maxNumberOfConcurrentBuildJobs).sum();
runningBuildJobCount = getBuildAgentInformation().stream().mapToInt(BuildAgentInformation::numberOfCurrentBuildJobs).sum();
}

/**
Expand All @@ -443,8 +443,8 @@ private void getBuildAgentsCapacity() {
* @return the build start date and estimated completion date of the submission if it is currently being processed, null otherwise
*/
public BuildTimingInfo isSubmissionProcessing(long participationId, String commitHash) {
var buildJob = processingJobs.values().stream()
.filter(job -> job.participationId() == participationId && Objects.equals(commitHash, job.buildConfig().assignmentCommitHash())).findFirst();
var buildJob = getProcessingJobs().stream().filter(job -> job.participationId() == participationId && Objects.equals(commitHash, job.buildConfig().assignmentCommitHash()))
.findFirst();
if (buildJob.isPresent()) {
return new BuildTimingInfo(buildJob.get().jobTimingInfo().buildStartDate(), buildJob.get().jobTimingInfo().estimatedCompletionDate());
}
Expand Down

0 comments on commit 3037731

Please sign in to comment.