use of org.sonar.db.ce.CeQueueDto in project sonarqube by SonarSource.
the class CeQueueImpl method massSubmit.
@Override
public List<CeTask> massSubmit(Collection<CeTaskSubmit> submissions) {
checkState(!submitPaused.get(), "Compute Engine does not currently accept new tasks");
if (submissions.isEmpty()) {
return Collections.emptyList();
}
try (DbSession dbSession = dbClient.openSession(true)) {
List<CeQueueDto> ceQueueDtos = from(submissions).transform(new CeTaskSubmitToInsertedCeQueueDto(dbSession, dbClient)).toList();
List<CeTask> tasks = loadTasks(dbSession, ceQueueDtos);
dbSession.commit();
return tasks;
}
}
use of org.sonar.db.ce.CeQueueDto in project sonarqube by SonarSource.
the class InternalCeQueueImpl method remove.
@Override
public void remove(CeTask task, CeActivityDto.Status status, @Nullable CeTaskResult taskResult, @Nullable Throwable error) {
checkArgument(error == null || status == CeActivityDto.Status.FAILED, "Error can be provided only when status is FAILED");
try (DbSession dbSession = dbClient.openSession(false)) {
Optional<CeQueueDto> queueDto = dbClient.ceQueueDao().selectByUuid(dbSession, task.getUuid());
checkState(queueDto.isPresent(), "Task does not exist anymore: %s", task);
CeActivityDto activityDto = new CeActivityDto(queueDto.get());
activityDto.setStatus(status);
updateQueueStatus(status, activityDto);
updateTaskResult(activityDto, taskResult);
updateError(activityDto, error);
remove(dbSession, queueDto.get(), activityDto);
}
}
use of org.sonar.db.ce.CeQueueDto in project sonarqube by SonarSource.
the class InternalCeQueueImpl method peek.
@Override
public Optional<CeTask> peek() {
if (peekPaused.get()) {
return Optional.absent();
}
try (DbSession dbSession = dbClient.openSession(false)) {
Optional<CeQueueDto> dto = dbClient.ceQueueDao().peek(dbSession);
CeTask task = null;
if (dto.isPresent()) {
task = loadTask(dbSession, dto.get());
queueStatus.addInProgress();
}
return Optional.fromNullable(task);
}
}
use of org.sonar.db.ce.CeQueueDto in project sonarqube by SonarSource.
the class ComponentActionTest method insertQueue.
private CeQueueDto insertQueue(String taskUuid, String componentUuid, CeQueueDto.Status status) {
CeQueueDto queueDto = new CeQueueDto();
queueDto.setTaskType(CeTaskTypes.REPORT);
queueDto.setComponentUuid(componentUuid);
queueDto.setUuid(taskUuid);
queueDto.setStatus(status);
dbTester.getDbClient().ceQueueDao().insert(dbTester.getSession(), queueDto);
dbTester.getSession().commit();
return queueDto;
}
use of org.sonar.db.ce.CeQueueDto in project sonarqube by SonarSource.
the class TaskActionTest method get_project_queue_task_with_scan_permission_on_organization_but_not_on_project.
@Test
public void get_project_queue_task_with_scan_permission_on_organization_but_not_on_project() {
userSession.logIn().addPermission(SCAN, project.getOrganizationUuid());
CeQueueDto task = createAndPersistQueueTask(project);
call(task.getUuid());
}
Aggregations