Search in sources :

Example 6 with SingularityDeleteResult

use of com.hubspot.singularity.SingularityDeleteResult in project Singularity by HubSpot.

the class SingularityUsageCleanerPoller method deleteObsoleteSlaveUsage.

private void deleteObsoleteSlaveUsage() {
    Set<String> slaveIdsToTrackUsageFor = usageHelper.getSlaveIdsToTrackUsageFor();
    for (String slaveIdWithUsage : usageManager.getSlavesWithUsage()) {
        if (slaveIdsToTrackUsageFor.contains(slaveIdWithUsage)) {
            continue;
        }
        SingularityDeleteResult result = usageManager.deleteSlaveUsage(slaveIdWithUsage);
        LOG.debug("Deleted obsolete slave usage {} - {}", slaveIdWithUsage, result);
    }
}
Also used : SingularityDeleteResult(com.hubspot.singularity.SingularityDeleteResult)

Example 7 with SingularityDeleteResult

use of com.hubspot.singularity.SingularityDeleteResult in project Singularity by HubSpot.

the class SingularityUsageCleanerPoller method deleteObsoleteTaskUsage.

private void deleteObsoleteTaskUsage() {
    Set<String> taskIds = new HashSet<>(taskManager.getActiveTaskIdsAsStrings());
    List<String> taskIdsWithUsage = usageManager.getTasksWithUsage();
    for (String taskIdWithUsage : taskIdsWithUsage) {
        if (taskIds.contains(taskIdWithUsage)) {
            continue;
        }
        SingularityDeleteResult result = usageManager.deleteTaskUsage(taskIdWithUsage);
        LOG.debug("Deleted obsolete task usage {} - {}", taskIdWithUsage, result);
    }
}
Also used : SingularityDeleteResult(com.hubspot.singularity.SingularityDeleteResult) HashSet(java.util.HashSet)

Example 8 with SingularityDeleteResult

use of com.hubspot.singularity.SingularityDeleteResult in project Singularity by HubSpot.

the class PriorityResource method deleteActivePriorityFreeze.

@DELETE
@Path("/freeze")
@ApiOperation("Stops the active priority freeze.")
@ApiResponses({ @ApiResponse(code = 202, message = "The active priority freeze was deleted."), @ApiResponse(code = 400, message = "There was no active priority freeze to delete.") })
public void deleteActivePriorityFreeze(@Auth SingularityUser user) {
    authorizationHelper.checkAdminAuthorization(user);
    final SingularityDeleteResult deleteResult = priorityManager.deleteActivePriorityFreeze();
    checkBadRequest(deleteResult == SingularityDeleteResult.DELETED, "No active priority freeze to delete.");
    priorityManager.clearPriorityKill();
}
Also used : SingularityDeleteResult(com.hubspot.singularity.SingularityDeleteResult) Path(javax.ws.rs.Path) DELETE(javax.ws.rs.DELETE) ApiOperation(com.wordnik.swagger.annotations.ApiOperation) ApiResponses(com.wordnik.swagger.annotations.ApiResponses)

Example 9 with SingularityDeleteResult

use of com.hubspot.singularity.SingularityDeleteResult in project Singularity by HubSpot.

the class RequestResource method deleteExpiringObject.

private <T extends SingularityExpiringRequestActionParent<?>> SingularityRequestParent deleteExpiringObject(Class<T> clazz, String requestId, SingularityUser user) {
    SingularityRequestWithState requestWithState = fetchRequestWithState(requestId, user);
    SingularityDeleteResult deleteResult = requestManager.deleteExpiringObject(clazz, requestId);
    WebExceptions.checkNotFound(deleteResult == SingularityDeleteResult.DELETED, "%s didn't have an expiring %s request", clazz.getSimpleName(), requestId);
    return fillEntireRequest(requestWithState);
}
Also used : SingularityRequestWithState(com.hubspot.singularity.SingularityRequestWithState) SingularityDeleteResult(com.hubspot.singularity.SingularityDeleteResult)

Example 10 with SingularityDeleteResult

use of com.hubspot.singularity.SingularityDeleteResult in project Singularity by HubSpot.

the class SingularityCleaner method cleanupRequestData.

private void cleanupRequestData(SingularityRequestCleanup requestCleanup) {
    SingularityDeleteResult deletePendingDeployResult = deployManager.deletePendingDeploy(requestCleanup.getRequestId());
    SingularityDeleteResult deleteRequestDeployStateResult = deployManager.deleteRequestDeployState(requestCleanup.getRequestId());
    LOG.trace("Deleted pendingDeploy ({}) and requestDeployState ({}) due to {}", deletePendingDeployResult, deleteRequestDeployStateResult, requestCleanup);
    taskManager.deleteRequestId(requestCleanup.getRequestId());
    deployManager.deleteRequestId(requestCleanup.getRequestId());
    LOG.trace("Deleted stale request data for {}", requestCleanup.getRequestId());
}
Also used : SingularityDeleteResult(com.hubspot.singularity.SingularityDeleteResult)

Aggregations

SingularityDeleteResult (com.hubspot.singularity.SingularityDeleteResult)10 SingularityRequestWithState (com.hubspot.singularity.SingularityRequestWithState)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 AtomicDouble (com.google.common.util.concurrent.AtomicDouble)1 SingularityKilledTaskIdRecord (com.hubspot.singularity.SingularityKilledTaskIdRecord)1 SingularitySlave (com.hubspot.singularity.SingularitySlave)1 SingularityTaskHistory (com.hubspot.singularity.SingularityTaskHistory)1 ApiOperation (com.wordnik.swagger.annotations.ApiOperation)1 ApiResponses (com.wordnik.swagger.annotations.ApiResponses)1 HashSet (java.util.HashSet)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 DELETE (javax.ws.rs.DELETE)1 Path (javax.ws.rs.Path)1