Search in sources :

Example 1 with SingularityAppcImage

use of com.hubspot.mesos.SingularityAppcImage 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

SingularityAppcImage (com.hubspot.mesos.SingularityAppcImage)1 SingularityDockerImage (com.hubspot.mesos.SingularityDockerImage)1 SingularityMesosImage (com.hubspot.mesos.SingularityMesosImage)1 SingularityMesosInfo (com.hubspot.mesos.SingularityMesosInfo)1 MesosInfo (org.apache.mesos.v1.Protos.ContainerInfo.MesosInfo)1 Image (org.apache.mesos.v1.Protos.Image)1