org.apache.mesos.Protos.ExecutorInfo Java Examples

The following examples show how to use org.apache.mesos.Protos.ExecutorInfo. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LaunchTaskTest.java    From storm with Apache License 2.0 6 votes vote down vote up
/**
 * Setup testing target & sample data.
 */
public LaunchTaskTest()
{
  SlaveID slaveID = SlaveID.newBuilder().setValue("s1").build();
  this.sampleTaskInfo =
      TaskInfo.newBuilder()
              .setName("t1").setSlaveId(slaveID)
              .setTaskId(TaskID.newBuilder().setValue("id2"))
              .setExecutor(
                  ExecutorInfo.newBuilder()
                              .setExecutorId(ExecutorID.newBuilder().setValue("e1"))
                              .setCommand(CommandInfo.getDefaultInstance()))
              .build();
  this.sampleOffer =
      Offer.newBuilder()
           .setHostname("h1").setSlaveId(slaveID)
           .setId(OfferID.newBuilder().setValue("id1"))
           .setFrameworkId(FrameworkID.newBuilder().setValue("f1").build())
           .build();
  this.target = new LaunchTask(sampleTaskInfo, sampleOffer);
}
 
Example #2
Source File: ClusterTaskOfferRequirementProvider.java    From dcos-cassandra-service with Apache License 2.0 6 votes vote down vote up
@Override
public OfferRequirement getReplacementOfferRequirement(String type, Protos.TaskInfo taskInfo) {
    LOGGER.info("Getting replacement requirement for task: {}",
            taskInfo.getTaskId().getValue());

    ExecutorInfo execInfo = taskInfo.getExecutor();
    taskInfo = Protos.TaskInfo.newBuilder(taskInfo).clearExecutor().build();

    try {
        return OfferRequirement.create(type, Arrays.asList(taskInfo), Optional.of(execInfo));
    } catch (InvalidRequirementException e) {
        LOGGER.error("Failed to construct OfferRequirement with Exception: ", e);
        return null;
    }

}
 
Example #3
Source File: ResourceMesosScheduler.java    From oodt with Apache License 2.0 6 votes vote down vote up
/**
 * Builds a TaskInfo from the given jobspec
 * @param job - JobSpec to TaskInfo-ify
 * @param offer - offer add extra data (SlaveId)
 * @return TaskInfo fully formed
 */
private TaskInfo getTaskInfo(JobSpec job,Offer offer) {
    TaskID taskId = TaskID.newBuilder().setValue(job.getJob().getId()).build();
    TaskInfo info = TaskInfo.newBuilder().setName("task " + taskId.getValue())
             .setTaskId(taskId)
             .setSlaveId(offer.getSlaveId())
             .addResources(Resource.newBuilder()
                           .setName("cpus")
                           .setType(Value.Type.SCALAR)
                           .setScalar(Value.Scalar.newBuilder().setValue(job.getJob().getLoadValue()*1.0)))
             .addResources(Resource.newBuilder()
                           .setName("mem")
                           .setType(Value.Type.SCALAR)
                           .setScalar(Value.Scalar.newBuilder().setValue(job.getJob().getLoadValue()*1024.0)))
             .setExecutor(ExecutorInfo.newBuilder(executor)).setData(MesosUtilities.jobSpecToByteString(job)).build();
    return info;
}
 
Example #4
Source File: BdsMesosScheduler.java    From BigDataScript with Apache License 2.0 5 votes vote down vote up
public BdsMesosScheduler(ExecutionerMesos executionerMesos, ExecutorInfo executor) {
	this.executionerMesos = executionerMesos;
	this.executor = executor;
	cluster = executionerMesos.getCluster();
	taskById = new HashMap<>();
	taskToLaunch = new HashSet<>();
	offersByHost = new HashMap<>();
	offersById = new HashMap<>();
}
 
Example #5
Source File: MesosSupervisor.java    From storm with Apache License 2.0 5 votes vote down vote up
@Override
public void registered(ExecutorDriver driver, ExecutorInfo executorInfo, FrameworkInfo frameworkInfo, SlaveInfo slaveInfo) {
  LOG.info("Received executor data <{}>", executorInfo.getData().toStringUtf8());
  Map ids = (Map) JSONValue.parse(executorInfo.getData().toStringUtf8());
  _executorId = executorInfo.getExecutorId().getValue();
  _supervisorId = (String) ids.get(MesosCommon.SUPERVISOR_ID);
  _assignmentId = (String) ids.get(MesosCommon.ASSIGNMENT_ID);
  LOG.info("Registered supervisor with Mesos: {}, {} ", _supervisorId, _assignmentId);

  // Completed registration, let anything waiting for us to do so continue
  _registeredLatch.countDown();
}
 
Example #6
Source File: REEFExecutor.java    From reef with Apache License 2.0 5 votes vote down vote up
@Override
public void registered(final ExecutorDriver driver,
                       final ExecutorInfo executorInfo,
                       final FrameworkInfo frameworkInfo,
                       final SlaveInfo slaveInfo) {
  LOG.log(Level.FINEST, "Executor registered. driver: {0} executorInfo: {1} frameworkInfo: {2} slaveInfo {3}",
      new Object[]{driver, executorInfo, frameworkInfo, slaveInfo});
}
 
Example #7
Source File: ResourceExecutor.java    From oodt with Apache License 2.0 5 votes vote down vote up
@Override
public void registered(ExecutorDriver arg0, ExecutorInfo arg1,
        FrameworkInfo arg2, SlaveInfo arg3) {
    System.out.println("Do-Wah-Do-Wah");
    str.println(id+"Registered, Huzzah!");

}
 
Example #8
Source File: ResourceMesosScheduler.java    From oodt with Apache License 2.0 5 votes vote down vote up
/**
 * Construct the scheduler
 * @param batch - batch manager (must be MesosBatchManager)
 * @param executor - Mesos ExecutorInfo
 * @param queue Job Queue used
 * @param mon - monitor used.
 */
public ResourceMesosScheduler(MesosBatchManager batch,ExecutorInfo executor, JobQueue queue, Monitor mon) {
    this.batch = batch;
    this.executor = executor;
    this.queue = queue;
    this.mon = mon;
    LOG.log(Level.INFO,"Creating the resource-mesos scheduler.");
}
 
Example #9
Source File: TestObjectFactory.java    From incubator-myriad with Apache License 2.0 5 votes vote down vote up
/**
* Returns a NodeTask given a ServiceResourceProfile and hostname
* 
* @param hostName
* @param profile
* @return
*/
public static NodeTask getNodeTask(String hostName, ServiceResourceProfile profile) {
  NodeTask task = new NodeTask(profile, new LikeConstraint(hostName, "host-[0-9]*.example.com"));
  task.setHostname(hostName);
  task.setTaskPrefix("nm");
  task.setSlaveId(SlaveID.newBuilder().setValue(profile.getName() + "-" + hostName).build());
  task.setExecutorInfo(ExecutorInfo.newBuilder().setExecutorId(ExecutorID.newBuilder().setValue("exec")).
       setCommand(org.apache.mesos.Protos.CommandInfo.newBuilder().setValue("command")).build());
  return task;
}
 
Example #10
Source File: ByteBufferSupportTest.java    From incubator-myriad with Apache License 2.0 5 votes vote down vote up
public void testExecutorInfoToFromByteBuffer() throws Exception {
  ExecutorInfo info = getExecutorInfo();   
  ByteBuffer bb = ByteBufferSupport.toByteBuffer(task);
  ExecutorInfo bInfo = ByteBufferSupport.toExecutorInfo(bb);

  assertEquals(info.getClass().getName(), bInfo.getClass().getName());
}
 
Example #11
Source File: ComposeRewriteHelper.java    From docker-compose-executor with Apache License 2.0 5 votes vote down vote up
public Map<String, Map<String, Map<String, Object>>> updateYaml(Map<String, Map<String, Map<String, Object>>> yamlMap,
                                                                TaskInfo taskInfo,
                                                                ExecutorInfo executorInfo) {

    log.debug(" ############ STARTING updateYaml  ################");
    if (yamlMap == null || yamlMap.isEmpty()) {
        return null;
    }
    Map<String, Map<String, Map<String, Object>>> resultantContainerMap = new HashMap<String, Map<String, Map<String, Object>>>();
    resultantContainerMap.putAll(yamlMap);
    String taskId = taskInfo.getTaskId().getValue();

    Iterator<Long> portIterator = getPortMappingIterator(taskInfo);
    String executorId = executorInfo.getExecutorId().getValue();
    log.debug(" executorId: " + executorId);
    Map<String, Map<String, Object>> services = yamlMap.get(SERVICES);
    log.debug(" services map: " + services.toString());
    Map<String, Map<String, Object>> resultantServicesMap = new HashMap<String, Map<String, Object>>();
    for (Map.Entry<String, Map<String, Object>> containerEntry : services.entrySet()) {

        String key = containerEntry.getKey();
        Map<String, Object> containerValue = containerEntry.getValue();
        Map<String, Object> updatedContainerValues = updateContainerValue(executorId,
                taskInfo,
                containerValue,
                portIterator);
        String updatedKey = prefixTaskId(taskId, key);
        resultantServicesMap.put(updatedKey, updatedContainerValues);
    }
    resultantContainerMap.put(SERVICES, resultantServicesMap);
    return resultantContainerMap;
}
 
Example #12
Source File: ClusterTaskOfferRequirementProvider.java    From dcos-cassandra-service with Apache License 2.0 5 votes vote down vote up
private OfferRequirement getExistingOfferRequirement(String type, Protos.TaskInfo taskInfo) {
    LOGGER.info("Getting existing OfferRequirement for task: {}", taskInfo);

    ExecutorInfo execInfo = taskInfo.getExecutor();
    taskInfo = Protos.TaskInfo.newBuilder(taskInfo).clearExecutor().build();

    try {
        return OfferRequirement.create(type, Arrays.asList(taskInfo), Optional.of(execInfo));
    } catch (InvalidRequirementException e) {
        LOGGER.error("Failed to construct OfferRequirement with Exception: ", e);
        return null;
    }
}
 
Example #13
Source File: ClusterTaskOfferRequirementProvider.java    From dcos-cassandra-service with Apache License 2.0 5 votes vote down vote up
private OfferRequirement getCreateOfferRequirement(String type, Protos.TaskInfo taskInfo) {
    ExecutorInfo execInfo = taskInfo.getExecutor();
    taskInfo = Protos.TaskInfo.newBuilder(taskInfo).clearExecutor().build();

    try {
        return OfferRequirement.create(type, Arrays.asList(taskInfo), Optional.of(execInfo));
    } catch (InvalidRequirementException e) {
        LOGGER.error("Failed to construct OfferRequirement with Exception: ", e);
        return null;
    }
}
 
Example #14
Source File: HelloWorldScheduler.java    From tutorials with MIT License 5 votes vote down vote up
@Override
public void resourceOffers(SchedulerDriver schedulerDriver, List<Offer> list) {

    for (Offer offer : list) {
        List<TaskInfo> tasks = new ArrayList<TaskInfo>();
        Protos.TaskID taskId = Protos.TaskID.newBuilder().setValue(Integer.toString(launchedTasks++)).build();

        System.out.println("Launching printHelloWorld " + taskId.getValue() + " Hello World Java");
        TaskInfo printHelloWorld = TaskInfo
                .newBuilder()
                .setName("printHelloWorld " + taskId.getValue())
                .setTaskId(taskId)
                .setSlaveId(offer.getSlaveId())
                .addResources(
                        Protos.Resource.newBuilder().setName("cpus").setType(Protos.Value.Type.SCALAR)
                                .setScalar(Protos.Value.Scalar.newBuilder().setValue(1)))
                .addResources(
                        Protos.Resource.newBuilder().setName("mem").setType(Protos.Value.Type.SCALAR)
                                .setScalar(Protos.Value.Scalar.newBuilder().setValue(128)))
                .setExecutor(ExecutorInfo.newBuilder(helloWorldExecutor)).build();

        List<OfferID> offerIDS = new ArrayList<>();
        offerIDS.add(offer.getId());

        tasks.add(printHelloWorld);

        schedulerDriver.declineOffer(offer.getId());
        schedulerDriver.launchTasks(offerIDS, tasks);
    }

}
 
Example #15
Source File: TaskExecutorTest.java    From shardingsphere-elasticjob-cloud with Apache License 2.0 5 votes vote down vote up
@Test
public void assertRegisteredWithoutData() {
    // CHECKSTYLE:OFF
    HashMap<String, String> data = new HashMap<>(4, 1);
    // CHECKSTYLE:ON
    data.put("event_trace_rdb_driver", "org.h2.Driver");
    data.put("event_trace_rdb_url", "jdbc:h2:mem:test_executor");
    data.put("event_trace_rdb_username", "sa");
    data.put("event_trace_rdb_password", "");
    ExecutorInfo executorInfo = ExecutorInfo.newBuilder().setExecutorId(Protos.ExecutorID.newBuilder().setValue("test_executor")).setCommand(Protos.CommandInfo.getDefaultInstance())
            .setData(ByteString.copyFrom(SerializationUtils.serialize(data))).build();
    taskExecutor.registered(executorDriver, executorInfo, frameworkInfo, slaveInfo);
}
 
Example #16
Source File: ResourceMesosSchedulerFactory.java    From oodt with Apache License 2.0 4 votes vote down vote up
public Scheduler construct() {
    try {
        String uri = System.getProperty("org.apache.oodt.cas.resource.mesos.executor.uri","./oodt-executor.in");
        //Framework info
        FrameworkInfo.Builder frameworkBuilder = FrameworkInfo.newBuilder()
                    .setName("OODT Resource Manager Mesos Framework").setUser("")
                    .setId(FrameworkID.newBuilder().setValue("OODT-Resource Framework").build());
        FrameworkInfo framework = frameworkBuilder.build();
        ExecutorInfo executor = ExecutorInfo.newBuilder().setExecutorId(ExecutorID.newBuilder().setValue("OODT-Resource").build())
                .setCommand(CommandInfo.newBuilder().setValue(new File(uri).getCanonicalPath()).build())
                .setName("OODT Resource Manager Executor").build();
        SchedulerDriver driver = null;

        //Resource manager properties
        String batchmgrClassStr = "org.apache.oodt.cas.resource.batchmgr.MesosBatchManagerFactory";
        String monitorClassStr = "org.apache.oodt.cas.resource.monitor.MesosMonitorFactory";
        String jobQueueClassStr = System.getProperty("resource.jobqueue.factory","org.apache.oodt.cas.resource.jobqueue.JobStackJobQueueFactory");
        String ip = System.getProperty("resource.mesos.master.ip","127.0.0.1:5050");

        batch = (MesosBatchManager)GenericResourceManagerObjectFactory.getBatchmgrServiceFromFactory(batchmgrClassStr);
        mon = GenericResourceManagerObjectFactory.getMonitorServiceFromFactory(monitorClassStr);
        queue = GenericResourceManagerObjectFactory.getJobQueueServiceFromFactory(jobQueueClassStr);
        batch.setMonitor(mon);
        batch.setDriver(driver);
        batch.setJobRepository(queue.getJobRepository());

        LOG.log(Level.INFO,"Connecting to Mesos Master at: "+ip);
        System.out.println("Connecting to Mesos Master at: "+ip);
        ResourceMesosScheduler scheduler = new ResourceMesosScheduler(batch, executor, queue, mon);

        final MesosSchedulerDriver mesos = new MesosSchedulerDriver(scheduler, framework, ip);
        //Anonymous thread to run
        new Thread(new Runnable() {
            public void run() {
                int status = mesos.run() == Status.DRIVER_STOPPED ? 0 : 1;
                mesos.stop();
            }
        }).start();
        return scheduler;
    } catch(IOException ioe) {
        LOG.log(Level.SEVERE,"Exception detected: "+ioe.getMessage());
        ioLOG.log(Level.SEVERE, e.getMessage());
        throw new RuntimeException(ioe);
    }
}
 
Example #17
Source File: HelloWorldScheduler.java    From tutorials with MIT License 4 votes vote down vote up
public HelloWorldScheduler(ExecutorInfo helloWorldExecutor) {
    this.helloWorldExecutor = helloWorldExecutor;
}
 
Example #18
Source File: TaskExecutorTest.java    From shardingsphere-elasticjob-cloud with Apache License 2.0 4 votes vote down vote up
@Before
public void setUp() throws NoSuchFieldException {
    taskExecutor = new TaskExecutor();
    ReflectionUtils.setFieldValue(taskExecutor, "executorService", executorService);
    executorInfo = ExecutorInfo.getDefaultInstance();
}
 
Example #19
Source File: MesosNimbus.java    From storm with Apache License 2.0 4 votes vote down vote up
private ExecutorInfo.Builder getExecutorInfoBuilder(TopologyDetails details, String executorDataStr,
                                                    String executorName,
                                                    List<Resource> executorResources,
                                                    String extraConfig) {
  String configUri;

  configUri = getFullConfigUri();

  ExecutorInfo.Builder executorInfoBuilder = ExecutorInfo.newBuilder();

  executorInfoBuilder
    .setName(executorName)
    .setExecutorId(ExecutorID.newBuilder().setValue(details.getId()))
    .setData(ByteString.copyFromUtf8(executorDataStr))
    .addAllResources(executorResources);

  ICommandLineShim commandLineShim = CommandLineShimFactory.makeCommandLineShim(_container.isPresent(), extraConfig);
  /**
   *  _container.isPresent() might be slightly misleading at first blush. It is only checking whether or not
   *  CONF_MESOS_CONTAINER_DOCKER_IMAGE is set to a value other than null.
   */
  if (_container.isPresent()) {
    executorInfoBuilder.setCommand(CommandInfo.newBuilder()
                                              .addUris(URI.newBuilder().setValue(configUri))
                                              .setValue(commandLineShim.getCommandLine(details.getId())))
                       .setContainer(ContainerInfo.newBuilder()
                                                  .setType(ContainerInfo.Type.DOCKER)
                                                  .setDocker(ContainerInfo.DockerInfo.newBuilder()
                                                                                     .setImage(_container.get())
                                                                                     .setNetwork(ContainerInfo.DockerInfo.Network.HOST)
                                                                                     .setForcePullImage(true)
                                                                                     .build()
                                                  ).build());
  } else {
    executorInfoBuilder.setCommand(CommandInfo.newBuilder()
                                              .addUris(URI.newBuilder().setValue((String) mesosStormConf.get(CONF_EXECUTOR_URI)))
                                              .addUris(URI.newBuilder().setValue(configUri))
                                              .setValue(commandLineShim.getCommandLine(details.getId())));
  }

  return executorInfoBuilder;
}
 
Example #20
Source File: REEFScheduler.java    From reef with Apache License 2.0 4 votes vote down vote up
/**
 * Greedily acquire resources by launching a Mesos Task(w/ our custom MesosExecutor) on REEF Evaluator request.
 * Either called from onResourceRequest(for a new request) or resourceOffers(for an outstanding request).
 * TODO[JIRA REEF-102]: reflect priority and rack/node locality specified in resourceRequestEvent.
 */
private synchronized void doResourceRequest(final ResourceRequestEvent resourceRequestEvent) {
  int tasksToLaunchCounter = resourceRequestEvent.getResourceCount();

  for (final Offer offer : this.offers.values()) {
    final int cpuSlots = getCpu(offer) / resourceRequestEvent.getVirtualCores().get();
    final int memSlots = getMemory(offer) / resourceRequestEvent.getMemorySize().get();
    final int taskNum = Math.min(Math.min(cpuSlots, memSlots), tasksToLaunchCounter);

    if (taskNum > 0 && satisfySlaveConstraint(resourceRequestEvent, offer)) {
      final List<TaskInfo> tasksToLaunch = new ArrayList<>();
      tasksToLaunchCounter -= taskNum;

      // Launch as many MesosTasks on the same node(offer) as possible to exploit locality.
      for (int j = 0; j < taskNum; j++) {
        final String id = offer.getId().getValue() + "-" + String.valueOf(j);
        final String executorLaunchCommand = getExecutorLaunchCommand(id, resourceRequestEvent.getMemorySize().get());

        final ExecutorInfo executorInfo = ExecutorInfo.newBuilder()
            .setExecutorId(ExecutorID.newBuilder()
                .setValue(id)
                .build())
            .setCommand(CommandInfo.newBuilder()
                .setValue(executorLaunchCommand)
                .addUris(URI.newBuilder().setValue(reefTarUri).build())
                .build())
            .build();

        final TaskInfo taskInfo = TaskInfo.newBuilder()
            .setTaskId(TaskID.newBuilder()
                .setValue(id)
                .build())
            .setName(id)
            .setSlaveId(offer.getSlaveId())
            .addResources(Resource.newBuilder()
                    .setName("mem")
                    .setType(Type.SCALAR)
                    .setScalar(Value.Scalar.newBuilder()
                            .setValue(resourceRequestEvent.getMemorySize().get())
                            .build())
                    .build())
            .addResources(Resource.newBuilder()
                    .setName("cpus")
                    .setType(Type.SCALAR)
                    .setScalar(Value.Scalar.newBuilder()
                            .setValue(resourceRequestEvent.getVirtualCores().get())
                            .build())
                    .build())
            .setExecutor(executorInfo)
            .build();

        tasksToLaunch.add(taskInfo);
        this.executorIdToLaunchedRequests.put(id, resourceRequestEvent);
      }

      final Filters filters = Filters.newBuilder().setRefuseSeconds(0).build();
      mesosMaster.launchTasks(Collections.singleton(offer.getId()), tasksToLaunch, filters);
    } else {
      mesosMaster.declineOffer(offer.getId());
    }
  }

  // the offers are no longer valid(all launched or declined)
  this.offers.clear();

  // Save leftovers that couldn't be launched
  outstandingRequests.add(ResourceRequestEventImpl.newBuilder()
      .mergeFrom(resourceRequestEvent)
      .setResourceCount(tasksToLaunchCounter)
      .build());
}
 
Example #21
Source File: InternalSchedulerDriver.java    From jesos with Apache License 2.0 4 votes vote down vote up
private void doLaunchTasks(final LaunchTasksMessage message)
{
    final MasterInfo masterInfo = context.connectedMaster();

    if (masterInfo == null) {
        loseAllTasks(message.getTasksList(), "Master disconnected");
        return;
    }

    final ImmutableList.Builder<TaskInfo> builder = ImmutableList.builder();

    for (TaskInfo taskInfo : message.getTasksList()) {
        if (taskInfo.hasExecutor() == taskInfo.hasCommand()) {
            loseTask(taskInfo, "TaskInfo must have either an 'executor' or a 'command'");
            continue; // for(...
        }

        if (taskInfo.hasExecutor()) {
            if (taskInfo.getExecutor().hasFrameworkId()) {
                final FrameworkID executorFrameworkId = taskInfo.getExecutor().getFrameworkId();
                if (!executorFrameworkId.equals(context.getFrameworkId())) {
                    loseTask(taskInfo, format("ExecutorInfo has an invalid FrameworkID (Actual: %s vs Expected: %s)", executorFrameworkId.getValue(), context.getFrameworkId().getValue()));
                    continue; // for(...
                }
            }
            else {
                // Executor present but not framework id. Set the framework id.
                taskInfo = TaskInfo.newBuilder(taskInfo)
                    .setExecutor(ExecutorInfo.newBuilder(taskInfo.getExecutor()).setFrameworkId(context.getFrameworkId()))
                    .build();
            }
        }

        builder.add(taskInfo);
    }

    final List<TaskInfo> launchTasks = builder.build();

    for (final OfferID offer : message.getOfferIdsList()) {
        if (!context.hasOffers(offer)) {
            LOG.warn("Unknown offer %s ignored!", offer.getValue());
        }

        for (final TaskInfo launchTask : launchTasks) {
            if (context.hasOffer(offer, launchTask.getSlaveId())) {
                context.addSlave(launchTask.getSlaveId(), context.getOffer(offer, launchTask.getSlaveId()));
            }
        }
        context.removeAllOffers(offer);
    }

    final LaunchTasksMessage launchMessage = LaunchTasksMessage.newBuilder(message)
        .setFrameworkId(context.getFrameworkId())
        .clearTasks()
        .addAllTasks(launchTasks)
        .build();

    eventBus.post(new RemoteMessageEnvelope(context.getDriverUPID(), context.getMasterUPID(), launchMessage));
}
 
Example #22
Source File: TMSTaskFactoryImpl.java    From incubator-myriad with Apache License 2.0 4 votes vote down vote up
@Override
public ExecutorInfo getExecutorInfoForSlave(ResourceOfferContainer resourceOfferContainer, FrameworkID frameworkId,
                                            CommandInfo commandInfo) {
  return null;
}
 
Example #23
Source File: ByteBufferSupportTest.java    From incubator-myriad with Apache License 2.0 4 votes vote down vote up
private ExecutorInfo getExecutorInfo() {
  FrameworkID id = Protos.FrameworkID.newBuilder().setValue("framework1").build();
  ExecutorID eid = Protos.ExecutorID.newBuilder().setValue("executor1").build();
  CommandInfo cm = Protos.CommandInfo.newBuilder().setValue("command").build();
  return ExecutorInfo.newBuilder().setFrameworkId(id).setExecutorId(eid).setCommand(cm).build();
}
 
Example #24
Source File: MyriadExecutor.java    From incubator-myriad with Apache License 2.0 4 votes vote down vote up
@Override
public void registered(ExecutorDriver driver, ExecutorInfo executorInfo, FrameworkInfo frameworkInfo, SlaveInfo slaveInfo) {
  LOGGER.debug("Registered ", executorInfo, " for framework ", frameworkInfo, " on mesos slave ", slaveInfo);
}
 
Example #25
Source File: PersistentOfferRequirementProvider.java    From dcos-cassandra-service with Apache License 2.0 4 votes vote down vote up
private static ExecutorInfo clearExecutorId(ExecutorInfo executorInfo) {
    return ExecutorInfo.newBuilder(executorInfo)
            .setExecutorId(Protos.ExecutorID.newBuilder().setValue("").build())
            .build();
}
 
Example #26
Source File: MesosExecutorCallbackHandler.java    From mantis with Apache License 2.0 4 votes vote down vote up
@Override
public void registered(ExecutorDriver arg0, ExecutorInfo arg1,
                       FrameworkInfo arg2, SlaveInfo arg3) {
    // TODO Auto-generated method stub

}
 
Example #27
Source File: TestObjectFactory.java    From incubator-myriad with Apache License 2.0 3 votes vote down vote up
/**
 * Returns a NodeTask with either a ServiceResourceProfile or an ExtendedResourceProfile, 
 * depending upon whether execCores and execMemory are null or non-null, respectively
 * 
 * @param profileName
 * @param hostName
 * @param cores
 * @param memory
 * @param execCores
 * @param execMemory
 * @return NodeTask
 */
public static NodeTask getNodeTask(String profileName, String hostName, Double cores, Double memory, 
    Long execCores, Long execMemory) {
  NodeTask task = new NodeTask(getServiceResourceProfile(profileName, cores, memory, execCores, execMemory), 
      new LikeConstraint(hostName, "host-[0-9]*.example.com"));
  task.setHostname(hostName);
  task.setTaskPrefix("nm");
  task.setSlaveId(SlaveID.newBuilder().setValue(profileName + "-" + hostName).build());
  task.setExecutorInfo(ExecutorInfo.newBuilder().setExecutorId(ExecutorID.newBuilder().setValue("exec")).
      setCommand(org.apache.mesos.Protos.CommandInfo.newBuilder().setValue("command")).build());
  return task;
}
 
Example #28
Source File: HelloWorldMain.java    From tutorials with MIT License 3 votes vote down vote up
public static void main(String[] args) {

        String path = System.getProperty("user.dir")
                + "/target/libraries2-1.0.0-SNAPSHOT.jar";

        CommandInfo.URI uri = CommandInfo.URI.newBuilder().setValue(path).setExtract(false).build();

        String helloWorldCommand = "java -cp libraries2-1.0.0-SNAPSHOT.jar com.baeldung.mesos.executors.HelloWorldExecutor";
        CommandInfo commandInfoHelloWorld = CommandInfo.newBuilder().setValue(helloWorldCommand).addUris(uri)
                .build();

        ExecutorInfo executorHelloWorld = ExecutorInfo.newBuilder()
                .setExecutorId(Protos.ExecutorID.newBuilder().setValue("HelloWorldExecutor"))
                .setCommand(commandInfoHelloWorld).setName("Hello World (Java)").setSource("java").build();

        FrameworkInfo.Builder frameworkBuilder = FrameworkInfo.newBuilder().setFailoverTimeout(120000)
                .setUser("")
                .setName("Hello World Framework (Java)");

        frameworkBuilder.setPrincipal("test-framework-java");

        MesosSchedulerDriver driver = new MesosSchedulerDriver(new HelloWorldScheduler(executorHelloWorld), frameworkBuilder.build(), args[0]);

        int status = driver.run() == Protos.Status.DRIVER_STOPPED ? 0 : 1;

        // Ensure that the driver process terminates.
        driver.stop();

        System.exit(status);
    }
 
Example #29
Source File: BdsMesosExecutor.java    From BigDataScript with Apache License 2.0 2 votes vote down vote up
/**
 * Invoked once the executor driver has been able to successfully
 * connect with Mesos. In particular, a scheduler can pass some
 * data to it's executors through the FrameworkInfo.ExecutorInfo's
 * data field.
 */
@Override
public void registered(ExecutorDriver driver, ExecutorInfo executorInfo, FrameworkInfo frameworkInfo, SlaveInfo slaveInfo) {
	if (debug) Gpr.debug("Executor: Registered on " + slaveInfo.getHostname());
}