Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
BBesrour committed Nov 18, 2024
1 parent fa7bc1f commit c9fcc6c
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import de.tum.cit.aet.artemis.core.security.annotations.EnforceAtLeastStudent;
import de.tum.cit.aet.artemis.core.security.annotations.enforceRoleInCourse.EnforceAtLeastInstructorInCourse;
import de.tum.cit.aet.artemis.core.service.AuthorizationCheckService;
import de.tum.cit.aet.artemis.core.util.TimeLogUtil;
import de.tum.cit.aet.artemis.programming.domain.build.BuildJob;
import de.tum.cit.aet.artemis.programming.repository.BuildJobRepository;
import de.tum.cit.aet.artemis.programming.service.localci.SharedQueueManagementService;
Expand Down Expand Up @@ -191,13 +192,22 @@ public ResponseEntity<BuildJobsStatisticsDTO> getBuildJobStatistics(@PathVariabl
return ResponseEntity.ok(buildJobStatistics);
}

/**
* Returns the estimated queue duration for a build job.
*
* @param participationId the id of the participation
* @return the estimated queue duration
*/
@GetMapping("queued-jobs/queue-duration-estimation")
@EnforceAtLeastStudent
public ResponseEntity<ZonedDateTime> getBuildJobQueueDurationEstimation(@RequestParam long participationId) {
var start = System.nanoTime();
if (participationId == 0) {
ResponseEntity.badRequest().build();
}
return ResponseEntity.ok(localCIBuildJobQueueService.getBuildJobEstimatedQueueDuration(participationId));
var estimatedQueueDuration = localCIBuildJobQueueService.getBuildJobEstimatedQueueDuration(participationId);
log.debug("Queue duration estimation took {} ms", TimeLogUtil.formatDurationFrom(start));
return ResponseEntity.ok(estimatedQueueDuration);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@
}
@case (ResultTemplateStatus.IS_BUILDING) {
@if (showProgressBar && estimatedRemaining) {
<div class="progress position-relative" role="progressbar" [style.min-width.px]="250" [style.height.px]="30">
<div class="progress-bar progress-bar-striped progress-bar-animated" [style.width.%]="progressBarValue"></div>
<span class="position-absolute fw-bold" style="top: 6px; left: 70px" [style.font-size.px]="14.4">{{
'Remaining: ' + (estimatedRemaining | artemisDurationFromSeconds)
}}</span>
<div class="d-flex justify-content-center align-items-center">
<div class="progress position-relative" role="progressbar" [style.min-width.px]="200" [style.height.px]="30">
<div class="progress-bar progress-bar-striped progress-bar-animated" [style.width.%]="progressBarValue"></div>
<div class="position-absolute fw-bold" style="top: 6px; left: 70px" [style.font-size.px]="14.4">
<span jhiTranslate="artemisApp.editor.eta"></span>
<span>{{ estimatedRemaining | artemisDurationFromSeconds }}</span>
</div>
</div>
<jhi-help-icon class="ms-2" text="artemisApp.editor.etaInfo" />
</div>
} @else {
<span class="text-primary">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import { SubmissionResultStatusComponent } from 'app/overview/submission-result-
import { UpdatingResultComponent } from 'app/exercises/shared/result/updating-result.component';
import { ArtemisProgrammingExerciseActionsModule } from 'app/exercises/programming/shared/actions/programming-exercise-actions.module';
import { ResultComponent } from 'app/exercises/shared/result/result.component';
import { ArtemisSharedComponentModule } from 'app/shared/components/shared-component.module';

@NgModule({
imports: [ArtemisSharedModule, ArtemisProgrammingExerciseActionsModule],
imports: [ArtemisSharedModule, ArtemisProgrammingExerciseActionsModule, ArtemisSharedComponentModule],
declarations: [SubmissionResultStatusComponent, UpdatingResultComponent, ResultComponent],
exports: [SubmissionResultStatusComponent, UpdatingResultComponent, ResultComponent],
})
Expand Down
2 changes: 2 additions & 0 deletions src/main/webapp/i18n/de/editor.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
"buildOutput": "Build Ergebnisse",
"building": "Build und Tests werden ausgeführt...",
"queued": "In Warteschlange...",
"eta": "ETA:",
"etaInfo": "Geschätzte Zeit bis zum Abschluss des Builds. Dies ist eine Schätzung und kann variieren.",
"buildFailed": "Build gescheitert",
"noBuildOutput": "Keine Build-Ergebnisse verfügbar.",
"generatingFeedback": "Feedback wird generiert...",
Expand Down
2 changes: 2 additions & 0 deletions src/main/webapp/i18n/en/editor.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
"buildOutput": "&nbsp; Build Output",
"building": "Building and testing...",
"queued": "Queued...",
"eta": "ETA:",
"etaInfo": "Estimated time until build is finished. This is an estimate and can vary.",
"buildFailed": "Build failed",
"noBuildOutput": "No build results available",
"generatingFeedback": "Generating feedback...",
Expand Down

0 comments on commit c9fcc6c

Please sign in to comment.