Search in sources :

Example 6 with Builder

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

the class SingularityMesosSchedulerClient method frameworkMessage.

/**
 * Sent by the scheduler to send arbitrary binary data to the executor. Mesos neither interprets this data nor
 * makes any guarantees about the delivery of this message to the executor. data is raw bytes encoded in Base64.
 *
 * @param executorId
 * @param agentId
 * @param data
 */
public void frameworkMessage(ExecutorID executorId, AgentID agentId, byte[] data) {
    Builder message = build().setMessage(Message.newBuilder().setAgentId(agentId).setExecutorId(executorId).setData(ByteString.copyFrom(data)));
    sendCall(message, Type.MESSAGE);
}
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 7 with Builder

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

the class SingularityMesosSchedulerClient method accept.

public void accept(List<OfferID> offerIds, List<Offer.Operation> offerOperations, Filters filters) {
    Builder accept = build().setAccept(Accept.newBuilder().addAllOfferIds(offerIds).addAllOperations(offerOperations).setFilters(filters));
    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 8 with Builder

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

the class SingularityMesosSchedulerClient method kill.

public void kill(TaskID taskId, AgentID agentId, KillPolicy killPolicy) {
    Builder kill = build().setKill(Kill.newBuilder().setTaskId(taskId).setAgentId(agentId).setKillPolicy(killPolicy));
    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 9 with Builder

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

the class SingularityMesosSchedulerClient method kill.

public void kill(TaskID taskId, KillPolicy killPolicy) {
    Builder kill = build().setKill(Kill.newBuilder().setTaskId(taskId).setKillPolicy(killPolicy));
    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 10 with Builder

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

the class SingularityMesosTaskBuilder method prepareMesosInfo.

private void prepareMesosInfo(ContainerInfo.Builder containerBuilder, final SingularityContainerInfo containerInfo) {
    if (!containerInfo.getMesos().isPresent()) {
        return;
    }
    final MesosInfo.Builder builder = MesosInfo.newBuilder();
    final SingularityMesosInfo mesos = containerInfo.getMesos().get();
    if (mesos.getImage().isPresent()) {
        final SingularityMesosImage image = mesos.getImage().get();
        final Image.Builder imageBuilder = Image.newBuilder();
        imageBuilder.setType(Image.Type.valueOf(image.getType().toString()));
        if (image.getAppc().isPresent()) {
            final SingularityAppcImage appc = image.getAppc().get();
            final Image.Appc.Builder appcBuilder = Image.Appc.newBuilder();
            appcBuilder.setName(appc.getName());
            if (appc.getId().isPresent()) {
                appcBuilder.setId(appc.getId().get());
            }
            imageBuilder.setAppc(appcBuilder.build());
        }
        if (image.getDocker().isPresent()) {
            final SingularityDockerImage docker = image.getDocker().get();
            final Image.Docker.Builder dockerBuilder = Image.Docker.newBuilder();
            dockerBuilder.setName(docker.getName());
            imageBuilder.setDocker(dockerBuilder.build());
        }
        builder.setImage(imageBuilder.build());
    }
    containerBuilder.setMesos(builder.build());
}
Also used : MesosInfo(org.apache.mesos.v1.Protos.ContainerInfo.MesosInfo) SingularityMesosInfo(com.hubspot.mesos.SingularityMesosInfo) SingularityMesosInfo(com.hubspot.mesos.SingularityMesosInfo) SingularityAppcImage(com.hubspot.mesos.SingularityAppcImage) SingularityDockerImage(com.hubspot.mesos.SingularityDockerImage) SingularityMesosImage(com.hubspot.mesos.SingularityMesosImage) SingularityMesosImage(com.hubspot.mesos.SingularityMesosImage) SingularityDockerImage(com.hubspot.mesos.SingularityDockerImage) Image(org.apache.mesos.v1.Protos.Image) SingularityAppcImage(com.hubspot.mesos.SingularityAppcImage)

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