Search in sources :

Example 1 with Builder

use of org.apache.mesos.v1.scheduler.Protos.Call.Builder in project Singularity by HubSpot.

the class SingularityMesosSchedulerClient method acknowledge.

/**
 * Sent by the scheduler to acknowledge a status update. Note that with the new API, schedulers are responsible
 * for explicitly acknowledging the receipt of status updates that have status.uuid set. These status updates
 * are retried until they are acknowledged by the scheduler. The scheduler must not acknowledge status updates
 * that do not have status.uuid set, as they are not retried. The uuid field contains raw bytes encoded in Base64.
 *
 * @param agentId
 * @param taskId
 * @param uuid
 */
public void acknowledge(AgentID agentId, TaskID taskId, ByteString uuid) {
    Builder acknowledge = build().setAcknowledge(Acknowledge.newBuilder().setAgentId(agentId).setTaskId(taskId).setUuid(uuid));
    sendCall(acknowledge, Type.ACKNOWLEDGE);
}
Also used : MesosClientBuilder(com.mesosphere.mesos.rx.java.MesosClientBuilder) ProtobufMesosClientBuilder(com.mesosphere.mesos.rx.java.protobuf.ProtobufMesosClientBuilder) Builder(org.apache.mesos.v1.scheduler.Protos.Call.Builder)

Example 2 with Builder

use of org.apache.mesos.v1.scheduler.Protos.Call.Builder in project Singularity by HubSpot.

the class SingularityMesosSchedulerClient method kill.

/**
 * Sent by the scheduler to kill a specific task. If the scheduler has a custom executor, the kill is
 * forwarded to the executor; it is up to the executor to kill the task and send a TASK_KILLED
 * (or TASK_FAILED) update. If the task hasn’t yet been delivered to the executor when Mesos master or
 * agent receives the kill request, a TASK_KILLED is generated and the task launch is not forwarded to
 * the executor. Note that if the task belongs to a task group, killing of one task results in all tasks
 * in the task group being killed. Mesos releases the resources for a task once it receives a terminal
 * update for the task. If the task is unknown to the master, a TASK_LOST will be generated.
 *
 * @param taskId
 */
public void kill(TaskID taskId) {
    Builder kill = build().setKill(Kill.newBuilder().setTaskId(taskId));
    sendCall(kill, Type.KILL);
}
Also used : MesosClientBuilder(com.mesosphere.mesos.rx.java.MesosClientBuilder) ProtobufMesosClientBuilder(com.mesosphere.mesos.rx.java.protobuf.ProtobufMesosClientBuilder) Builder(org.apache.mesos.v1.scheduler.Protos.Call.Builder)

Example 3 with Builder

use of org.apache.mesos.v1.scheduler.Protos.Call.Builder in project Singularity by HubSpot.

the class SingularityMesosSchedulerClient method decline.

/**
 * Sent by the scheduler to explicitly decline offer(s) received. Note that this is same as sending an
 * ACCEPT call with no operations.
 *
 * @param offerIds
 */
public void decline(List<OfferID> offerIds) {
    Builder decline = build().setDecline(Decline.newBuilder().addAllOfferIds(offerIds));
    sendCall(decline, Type.DECLINE);
}
Also used : MesosClientBuilder(com.mesosphere.mesos.rx.java.MesosClientBuilder) ProtobufMesosClientBuilder(com.mesosphere.mesos.rx.java.protobuf.ProtobufMesosClientBuilder) Builder(org.apache.mesos.v1.scheduler.Protos.Call.Builder)

Example 4 with Builder

use of org.apache.mesos.v1.scheduler.Protos.Call.Builder in project Singularity by HubSpot.

the class SingularityMesosSchedulerClient method accept.

/**
 * Sent by the scheduler when it accepts offer(s) sent by the master. The ACCEPT request includes the type of
 * operations (e.g., launch task, launch task group, reserve resources, create volumes) that the scheduler wants to
 * perform on the offers. Note that until the scheduler replies (accepts or declines) to an offer, the offer’s
 * resources are considered allocated to the offer’s role and to the framework.
 *
 * @param offerIds
 * @param offerOperations
 */
public void accept(List<OfferID> offerIds, List<Offer.Operation> offerOperations) {
    Builder accept = build().setAccept(Accept.newBuilder().addAllOfferIds(offerIds).addAllOperations(offerOperations));
    sendCall(accept, Type.ACCEPT);
}
Also used : MesosClientBuilder(com.mesosphere.mesos.rx.java.MesosClientBuilder) ProtobufMesosClientBuilder(com.mesosphere.mesos.rx.java.protobuf.ProtobufMesosClientBuilder) Builder(org.apache.mesos.v1.scheduler.Protos.Call.Builder)

Example 5 with Builder

use of org.apache.mesos.v1.scheduler.Protos.Call.Builder in project Singularity by HubSpot.

the class SingularityMesosSchedulerClient method shutdown.

/**
 * Sent by the scheduler to shutdown a specific custom executor. When an executor gets a shutdown event,
 * it is expected to kill all its tasks (and send TASK_KILLED updates) and terminate. If an executor
 * doesn’t terminate within a certain timeout, the agent will forcefully destroy the container
 * (executor and its tasks) and transition its active tasks to TASK_LOST.
 *
 * @param executorId
 */
public void shutdown(ExecutorID executorId) {
    Builder shutdown = build().setShutdown(Shutdown.newBuilder().setExecutorId(executorId));
    sendCall(shutdown, Type.SHUTDOWN);
}
Also used : MesosClientBuilder(com.mesosphere.mesos.rx.java.MesosClientBuilder) ProtobufMesosClientBuilder(com.mesosphere.mesos.rx.java.protobuf.ProtobufMesosClientBuilder) Builder(org.apache.mesos.v1.scheduler.Protos.Call.Builder)

Aggregations

MesosClientBuilder (com.mesosphere.mesos.rx.java.MesosClientBuilder)15 ProtobufMesosClientBuilder (com.mesosphere.mesos.rx.java.protobuf.ProtobufMesosClientBuilder)15 Builder (org.apache.mesos.v1.scheduler.Protos.Call.Builder)15 SingularityAppcImage (com.hubspot.mesos.SingularityAppcImage)2 SingularityDockerImage (com.hubspot.mesos.SingularityDockerImage)2 SingularityMesosImage (com.hubspot.mesos.SingularityMesosImage)2 SingularityMesosInfo (com.hubspot.mesos.SingularityMesosInfo)2 MesosInfo (org.apache.mesos.v1.Protos.ContainerInfo.MesosInfo)2 Image (org.apache.mesos.v1.Protos.Image)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Optional (com.google.common.base.Optional)1 Strings (com.google.common.base.Strings)1 Supplier (com.google.common.base.Supplier)1 ImmutableList (com.google.common.collect.ImmutableList)1 Ints (com.google.common.primitives.Ints)1 Inject (com.google.inject.Inject)1 ByteString (com.google.protobuf.ByteString)1 ExecutorDataBuilder (com.hubspot.deploy.ExecutorDataBuilder)1 Resources (com.hubspot.mesos.Resources)1