use of com.hubspot.singularity.SingularityDeployUpdate in project Singularity by HubSpot.
the class DeployManager method saveDeploy.
public SingularityCreateResult saveDeploy(SingularityRequest request, SingularityDeployMarker deployMarker, SingularityDeploy deploy) {
final SingularityCreateResult deploySaveResult = create(getDeployDataPath(deploy.getRequestId(), deploy.getId()), deploy, deployTranscoder);
if (deploySaveResult == SingularityCreateResult.EXISTED) {
LOG.info("Deploy object for {} already existed (new marker: {})", deploy, deployMarker);
}
singularityEventListener.deployHistoryEvent(new SingularityDeployUpdate(deployMarker, Optional.of(deploy), DeployEventType.STARTING, Optional.<SingularityDeployResult>absent()));
create(getDeployMarkerPath(deploy.getRequestId(), deploy.getId()), deployMarker, deployMarkerTranscoder);
final Optional<SingularityRequestDeployState> currentState = getRequestDeployState(deploy.getRequestId());
Optional<SingularityDeployMarker> activeDeploy = Optional.absent();
Optional<SingularityDeployMarker> pendingDeploy = Optional.absent();
if (request.isDeployable()) {
if (currentState.isPresent()) {
activeDeploy = currentState.get().getActiveDeploy();
}
pendingDeploy = Optional.of(deployMarker);
} else {
activeDeploy = Optional.of(deployMarker);
}
final SingularityRequestDeployState newState = new SingularityRequestDeployState(deploy.getRequestId(), activeDeploy, pendingDeploy);
return saveNewRequestDeployState(newState);
}
use of com.hubspot.singularity.SingularityDeployUpdate in project Singularity by HubSpot.
the class SingularityWebhookSender method checkDeployUpdates.
private int checkDeployUpdates(SingularityWebhook webhook, List<CompletableFuture<Response>> webhookFutures) {
final List<SingularityDeployUpdate> deployUpdates = webhookManager.getQueuedDeployUpdatesForHook(webhook.getId());
int numDeployUpdates = 0;
for (SingularityDeployUpdate deployUpdate : deployUpdates) {
webhookFutures.add(webhookSemaphore.call(() -> executeWebhookAsync(webhook, deployUpdate, new SingularityDeployWebhookAsyncHandler(webhookManager, webhook, deployUpdate, shouldDeleteUpdateOnFailure(numDeployUpdates, deployUpdate.getDeployMarker().getTimestamp())))));
}
return deployUpdates.size();
}
Aggregations