use of org.jboss.pnc.spi.coordinator.BuildTask in project pnc by project-ncl.
the class BuildProviderImpl method getRunningCount.
@Override
public RunningBuildCount getRunningCount() {
List<BuildTask> x = buildCoordinator.getSubmittedBuildTasks();
int waitingForDependencies = 0;
int running = 0;
int enqueued = 0;
for (BuildTask task : x) {
switch(task.getStatus()) {
case ENQUEUED:
enqueued++;
continue;
case BUILDING:
running++;
continue;
case WAITING_FOR_DEPENDENCIES:
waitingForDependencies++;
continue;
}
}
return new RunningBuildCount(running, enqueued, waitingForDependencies);
}
use of org.jboss.pnc.spi.coordinator.BuildTask in project pnc by project-ncl.
the class BuildTriggererImpl method doTriggerBuild.
private BuildSetTask doTriggerBuild(final int buildConfigId, OptionalInt buildConfigurationRevision, BuildOptions buildOptions) throws BuildConflictException, CoreException {
BuildSetTask buildSetTask;
if (buildConfigurationRevision.isPresent()) {
final BuildConfigurationAudited buildConfigurationAudited = buildConfigurationAuditedRepository.queryById(new IdRev(buildConfigId, buildConfigurationRevision.getAsInt()));
Preconditions.checkArgument(buildConfigurationAudited != null, "Can't find Build Configuration with id=" + buildConfigId + ", rev=" + buildConfigurationRevision.getAsInt());
buildSetTask = buildCoordinator.build(hibernateLazyInitializer.initializeBuildConfigurationAuditedBeforeTriggeringIt(buildConfigurationAudited), user.currentUser(), buildOptions);
} else {
final BuildConfiguration buildConfiguration = buildConfigurationRepository.queryById(buildConfigId);
Preconditions.checkArgument(buildConfiguration != null, "Can't find Build Configuration with id=" + buildConfigId);
buildSetTask = buildCoordinator.build(hibernateLazyInitializer.initializeBuildConfigurationBeforeTriggeringIt(buildConfiguration), user.currentUser(), buildOptions);
}
logger.info("Started build of Build Configuration {}. Build Tasks: {}", buildConfigId, buildSetTask.getBuildTasks().stream().map(BuildTask::getId).collect(Collectors.joining()));
return buildSetTask;
}
use of org.jboss.pnc.spi.coordinator.BuildTask in project pnc by project-ncl.
the class BuildTriggererImpl method doTriggerGroupBuild.
private BuildSetTask doTriggerGroupBuild(final int groupConfigId, Optional<GroupBuildRequest> revs, BuildOptions buildOptions) throws CoreException {
final BuildConfigurationSet buildConfigurationSet = buildConfigurationSetRepository.queryById(groupConfigId);
Preconditions.checkArgument(buildConfigurationSet != null, "Can't find configuration with given id=" + groupConfigId);
List<BuildConfigurationRevisionRef> revisions = revs.map(GroupBuildRequest::getBuildConfigurationRevisions).orElse(Collections.emptyList());
BuildSetTask buildSetTask = buildCoordinator.build(hibernateLazyInitializer.initializeBuildConfigurationSetBeforeTriggeringIt(buildConfigurationSet), loadAuditedsFromDB(buildConfigurationSet, revisions), user.currentUser(), buildOptions);
logger.info("Started build of Group Configuration {}. Build Tasks: {}", groupConfigId, buildSetTask.getBuildTasks().stream().map(BuildTask::getId).collect(Collectors.joining()));
return buildSetTask;
}
Aggregations