Search in sources :

Example 1 with SingularityPendingRequestParent

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

the class SingularityClient method updateAuthorizedGroups.

public SingularityPendingRequestParent updateAuthorizedGroups(String requestId, SingularityUpdateGroupsRequest updateGroupsRequest) {
    final Function<String, String> requestUri = (host) -> String.format(REQUEST_GROUPS_UPDATE_FORMAT, getApiBase(host), requestId);
    final HttpResponse response = post(requestUri, String.format("update authorized groups of request %s", requestId), Optional.of(updateGroupsRequest));
    return response.getAs(SingularityPendingRequestParent.class);
}
Also used : SingularityTask(com.hubspot.singularity.SingularityTask) Arrays(java.util.Arrays) Method(com.hubspot.horizon.HttpRequest.Method) ExtendedTaskState(com.hubspot.singularity.ExtendedTaskState) SingularityTaskCleanupResult(com.hubspot.singularity.SingularityTaskCleanupResult) SingularityPaginatedResponse(com.hubspot.singularity.SingularityPaginatedResponse) SingularityWebhook(com.hubspot.singularity.SingularityWebhook) Provider(javax.inject.Provider) Retryer(com.github.rholder.retry.Retryer) RetryerBuilder(com.github.rholder.retry.RetryerBuilder) SingularityDeployRequest(com.hubspot.singularity.api.SingularityDeployRequest) RetryException(com.github.rholder.retry.RetryException) Inject(com.google.inject.Inject) SingularityRequestCleanup(com.hubspot.singularity.SingularityRequestCleanup) SingularityState(com.hubspot.singularity.SingularityState) LoggerFactory(org.slf4j.LoggerFactory) Random(java.util.Random) SingularityTaskReconciliationStatistics(com.hubspot.singularity.SingularityTaskReconciliationStatistics) SingularityRequestGroup(com.hubspot.singularity.SingularityRequestGroup) SingularityDisasterType(com.hubspot.singularity.SingularityDisasterType) SingularityBounceRequest(com.hubspot.singularity.api.SingularityBounceRequest) SingularityPauseRequest(com.hubspot.singularity.api.SingularityPauseRequest) SingularityUpdateGroupsRequest(com.hubspot.singularity.api.SingularityUpdateGroupsRequest) Optional(com.google.common.base.Optional) Map(java.util.Map) HttpRequest(com.hubspot.horizon.HttpRequest) HttpClient(com.hubspot.horizon.HttpClient) TypeReference(com.fasterxml.jackson.core.type.TypeReference) SingularityPriorityFreeze(com.hubspot.singularity.api.SingularityPriorityFreeze) SingularityDisabledAction(com.hubspot.singularity.SingularityDisabledAction) SingularityPendingTaskId(com.hubspot.singularity.SingularityPendingTaskId) SingularityTaskId(com.hubspot.singularity.SingularityTaskId) SingularityUnpauseRequest(com.hubspot.singularity.api.SingularityUnpauseRequest) SingularityMachineChangeRequest(com.hubspot.singularity.api.SingularityMachineChangeRequest) SingularityDisastersData(com.hubspot.singularity.SingularityDisastersData) ImmutableMap(com.google.common.collect.ImmutableMap) SingularityPriorityFreezeParent(com.hubspot.singularity.SingularityPriorityFreezeParent) Predicate(java.util.function.Predicate) Collection(java.util.Collection) SingularityUpdatePendingDeployRequest(com.hubspot.singularity.SingularityUpdatePendingDeployRequest) List(java.util.List) SingularityTaskShellCommandRequest(com.hubspot.singularity.SingularityTaskShellCommandRequest) SingularityTaskShellCommandUpdate(com.hubspot.singularity.SingularityTaskShellCommandUpdate) StopStrategies(com.github.rholder.retry.StopStrategies) SingularityClusterUtilization(com.hubspot.singularity.SingularityClusterUtilization) OrderDirection(com.hubspot.singularity.OrderDirection) SingularityAuthorizationScope(com.hubspot.singularity.SingularityAuthorizationScope) Entry(java.util.Map.Entry) SingularitySandbox(com.hubspot.singularity.SingularitySandbox) SingularityS3Log(com.hubspot.singularity.SingularityS3Log) SingularityDisabledActionRequest(com.hubspot.singularity.api.SingularityDisabledActionRequest) SingularityCreateResult(com.hubspot.singularity.SingularityCreateResult) SingularityRequest(com.hubspot.singularity.SingularityRequest) SingularityTaskHistoryUpdate(com.hubspot.singularity.SingularityTaskHistoryUpdate) SingularityShellCommand(com.hubspot.singularity.SingularityShellCommand) SingularityRequestHistory(com.hubspot.singularity.SingularityRequestHistory) SingularityTaskIdHistory(com.hubspot.singularity.SingularityTaskIdHistory) SingularityPendingRequest(com.hubspot.singularity.SingularityPendingRequest) SingularityTaskShellCommandHistory(com.hubspot.singularity.SingularityTaskShellCommandHistory) HashMap(java.util.HashMap) SingularityClientCredentials(com.hubspot.singularity.SingularityClientCredentials) SingularityDeployUpdate(com.hubspot.singularity.SingularityDeployUpdate) Function(java.util.function.Function) SingularityTaskIdsByStatus(com.hubspot.singularity.SingularityTaskIdsByStatus) SingularityTaskState(com.hubspot.singularity.SingularityTaskState) SingularityExitCooldownRequest(com.hubspot.singularity.api.SingularityExitCooldownRequest) ArrayList(java.util.ArrayList) Builder(com.google.common.collect.ImmutableMap.Builder) ImmutableList(com.google.common.collect.ImmutableList) SingularitySlave(com.hubspot.singularity.SingularitySlave) SingularityDeleteResult(com.hubspot.singularity.SingularityDeleteResult) SingularityDeployKey(com.hubspot.singularity.SingularityDeployKey) RetryStrategy(com.hubspot.horizon.RetryStrategy) HttpResponse(com.hubspot.horizon.HttpResponse) SingularityPendingRequestParent(com.hubspot.singularity.SingularityPendingRequestParent) WaitStrategies(com.github.rholder.retry.WaitStrategies) SingularityAction(com.hubspot.singularity.SingularityAction) SingularityDeployHistory(com.hubspot.singularity.SingularityDeployHistory) Logger(org.slf4j.Logger) SingularityTaskHistory(com.hubspot.singularity.SingularityTaskHistory) Preconditions.checkNotNull(com.google.common.base.Preconditions.checkNotNull) SingularityDeploy(com.hubspot.singularity.SingularityDeploy) SingularityRack(com.hubspot.singularity.SingularityRack) ExecutionException(java.util.concurrent.ExecutionException) SingularityKillTaskRequest(com.hubspot.singularity.api.SingularityKillTaskRequest) SingularityTaskRequest(com.hubspot.singularity.SingularityTaskRequest) MachineState(com.hubspot.singularity.MachineState) SingularityRequestParent(com.hubspot.singularity.SingularityRequestParent) SingularityDeleteRequestRequest(com.hubspot.singularity.api.SingularityDeleteRequestRequest) SingularityRunNowRequest(com.hubspot.singularity.api.SingularityRunNowRequest) Named(com.google.inject.name.Named) SingularityScaleRequest(com.hubspot.singularity.api.SingularityScaleRequest) MesosFileChunkObject(com.hubspot.mesos.json.MesosFileChunkObject) Collections(java.util.Collections) HttpResponse(com.hubspot.horizon.HttpResponse)

Example 2 with SingularityPendingRequestParent

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

the class SingularityClient method runSingularityRequest.

public SingularityPendingRequestParent runSingularityRequest(String requestId, Optional<SingularityRunNowRequest> runNowRequest) {
    final Function<String, String> requestUri = (host) -> String.format(REQUEST_RUN_FORMAT, getApiBase(host), requestId);
    final HttpResponse response = post(requestUri, String.format("run of request %s", requestId), runNowRequest);
    return response.getAs(SingularityPendingRequestParent.class);
}
Also used : SingularityTask(com.hubspot.singularity.SingularityTask) Arrays(java.util.Arrays) Method(com.hubspot.horizon.HttpRequest.Method) ExtendedTaskState(com.hubspot.singularity.ExtendedTaskState) SingularityTaskCleanupResult(com.hubspot.singularity.SingularityTaskCleanupResult) SingularityPaginatedResponse(com.hubspot.singularity.SingularityPaginatedResponse) SingularityWebhook(com.hubspot.singularity.SingularityWebhook) Provider(javax.inject.Provider) Retryer(com.github.rholder.retry.Retryer) RetryerBuilder(com.github.rholder.retry.RetryerBuilder) SingularityDeployRequest(com.hubspot.singularity.api.SingularityDeployRequest) RetryException(com.github.rholder.retry.RetryException) Inject(com.google.inject.Inject) SingularityRequestCleanup(com.hubspot.singularity.SingularityRequestCleanup) SingularityState(com.hubspot.singularity.SingularityState) LoggerFactory(org.slf4j.LoggerFactory) Random(java.util.Random) SingularityTaskReconciliationStatistics(com.hubspot.singularity.SingularityTaskReconciliationStatistics) SingularityRequestGroup(com.hubspot.singularity.SingularityRequestGroup) SingularityDisasterType(com.hubspot.singularity.SingularityDisasterType) SingularityBounceRequest(com.hubspot.singularity.api.SingularityBounceRequest) SingularityPauseRequest(com.hubspot.singularity.api.SingularityPauseRequest) SingularityUpdateGroupsRequest(com.hubspot.singularity.api.SingularityUpdateGroupsRequest) Optional(com.google.common.base.Optional) Map(java.util.Map) HttpRequest(com.hubspot.horizon.HttpRequest) HttpClient(com.hubspot.horizon.HttpClient) TypeReference(com.fasterxml.jackson.core.type.TypeReference) SingularityPriorityFreeze(com.hubspot.singularity.api.SingularityPriorityFreeze) SingularityDisabledAction(com.hubspot.singularity.SingularityDisabledAction) SingularityPendingTaskId(com.hubspot.singularity.SingularityPendingTaskId) SingularityTaskId(com.hubspot.singularity.SingularityTaskId) SingularityUnpauseRequest(com.hubspot.singularity.api.SingularityUnpauseRequest) SingularityMachineChangeRequest(com.hubspot.singularity.api.SingularityMachineChangeRequest) SingularityDisastersData(com.hubspot.singularity.SingularityDisastersData) ImmutableMap(com.google.common.collect.ImmutableMap) SingularityPriorityFreezeParent(com.hubspot.singularity.SingularityPriorityFreezeParent) Predicate(java.util.function.Predicate) Collection(java.util.Collection) SingularityUpdatePendingDeployRequest(com.hubspot.singularity.SingularityUpdatePendingDeployRequest) List(java.util.List) SingularityTaskShellCommandRequest(com.hubspot.singularity.SingularityTaskShellCommandRequest) SingularityTaskShellCommandUpdate(com.hubspot.singularity.SingularityTaskShellCommandUpdate) StopStrategies(com.github.rholder.retry.StopStrategies) SingularityClusterUtilization(com.hubspot.singularity.SingularityClusterUtilization) OrderDirection(com.hubspot.singularity.OrderDirection) SingularityAuthorizationScope(com.hubspot.singularity.SingularityAuthorizationScope) Entry(java.util.Map.Entry) SingularitySandbox(com.hubspot.singularity.SingularitySandbox) SingularityS3Log(com.hubspot.singularity.SingularityS3Log) SingularityDisabledActionRequest(com.hubspot.singularity.api.SingularityDisabledActionRequest) SingularityCreateResult(com.hubspot.singularity.SingularityCreateResult) SingularityRequest(com.hubspot.singularity.SingularityRequest) SingularityTaskHistoryUpdate(com.hubspot.singularity.SingularityTaskHistoryUpdate) SingularityShellCommand(com.hubspot.singularity.SingularityShellCommand) SingularityRequestHistory(com.hubspot.singularity.SingularityRequestHistory) SingularityTaskIdHistory(com.hubspot.singularity.SingularityTaskIdHistory) SingularityPendingRequest(com.hubspot.singularity.SingularityPendingRequest) SingularityTaskShellCommandHistory(com.hubspot.singularity.SingularityTaskShellCommandHistory) HashMap(java.util.HashMap) SingularityClientCredentials(com.hubspot.singularity.SingularityClientCredentials) SingularityDeployUpdate(com.hubspot.singularity.SingularityDeployUpdate) Function(java.util.function.Function) SingularityTaskIdsByStatus(com.hubspot.singularity.SingularityTaskIdsByStatus) SingularityTaskState(com.hubspot.singularity.SingularityTaskState) SingularityExitCooldownRequest(com.hubspot.singularity.api.SingularityExitCooldownRequest) ArrayList(java.util.ArrayList) Builder(com.google.common.collect.ImmutableMap.Builder) ImmutableList(com.google.common.collect.ImmutableList) SingularitySlave(com.hubspot.singularity.SingularitySlave) SingularityDeleteResult(com.hubspot.singularity.SingularityDeleteResult) SingularityDeployKey(com.hubspot.singularity.SingularityDeployKey) RetryStrategy(com.hubspot.horizon.RetryStrategy) HttpResponse(com.hubspot.horizon.HttpResponse) SingularityPendingRequestParent(com.hubspot.singularity.SingularityPendingRequestParent) WaitStrategies(com.github.rholder.retry.WaitStrategies) SingularityAction(com.hubspot.singularity.SingularityAction) SingularityDeployHistory(com.hubspot.singularity.SingularityDeployHistory) Logger(org.slf4j.Logger) SingularityTaskHistory(com.hubspot.singularity.SingularityTaskHistory) Preconditions.checkNotNull(com.google.common.base.Preconditions.checkNotNull) SingularityDeploy(com.hubspot.singularity.SingularityDeploy) SingularityRack(com.hubspot.singularity.SingularityRack) ExecutionException(java.util.concurrent.ExecutionException) SingularityKillTaskRequest(com.hubspot.singularity.api.SingularityKillTaskRequest) SingularityTaskRequest(com.hubspot.singularity.SingularityTaskRequest) MachineState(com.hubspot.singularity.MachineState) SingularityRequestParent(com.hubspot.singularity.SingularityRequestParent) SingularityDeleteRequestRequest(com.hubspot.singularity.api.SingularityDeleteRequestRequest) SingularityRunNowRequest(com.hubspot.singularity.api.SingularityRunNowRequest) Named(com.google.inject.name.Named) SingularityScaleRequest(com.hubspot.singularity.api.SingularityScaleRequest) MesosFileChunkObject(com.hubspot.mesos.json.MesosFileChunkObject) Collections(java.util.Collections) HttpResponse(com.hubspot.horizon.HttpResponse)

Aggregations

TypeReference (com.fasterxml.jackson.core.type.TypeReference)2 RetryException (com.github.rholder.retry.RetryException)2 Retryer (com.github.rholder.retry.Retryer)2 RetryerBuilder (com.github.rholder.retry.RetryerBuilder)2 StopStrategies (com.github.rholder.retry.StopStrategies)2 WaitStrategies (com.github.rholder.retry.WaitStrategies)2 Optional (com.google.common.base.Optional)2 Preconditions.checkNotNull (com.google.common.base.Preconditions.checkNotNull)2 ImmutableList (com.google.common.collect.ImmutableList)2 ImmutableMap (com.google.common.collect.ImmutableMap)2 Builder (com.google.common.collect.ImmutableMap.Builder)2 Inject (com.google.inject.Inject)2 Named (com.google.inject.name.Named)2 HttpClient (com.hubspot.horizon.HttpClient)2 HttpRequest (com.hubspot.horizon.HttpRequest)2 Method (com.hubspot.horizon.HttpRequest.Method)2 HttpResponse (com.hubspot.horizon.HttpResponse)2 RetryStrategy (com.hubspot.horizon.RetryStrategy)2 MesosFileChunkObject (com.hubspot.mesos.json.MesosFileChunkObject)2 ExtendedTaskState (com.hubspot.singularity.ExtendedTaskState)2