final ch.qos.logback.classic.Logger taskLog = taskBuilder.buildTaskLogger(taskId, taskInfo.getExecutor().getExecutorId().getValue()); final SingularityExecutorTask task = taskBuilder.buildTask(taskId, executorDriver, taskInfo, taskLog);
/** * 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 executorDriver, Protos.ExecutorInfo executorInfo, Protos.FrameworkInfo frameworkInfo, Protos.SlaveInfo slaveInfo) { LOG.debug("Registered {} with Mesos slave {} for framework {}", executorInfo.getExecutorId().getValue(), slaveInfo.getId().getValue(), frameworkInfo.getId().getValue()); LOG.trace("Registered {} with Mesos slave {} for framework {}", MesosUtils.formatForLogging(executorInfo), MesosUtils.formatForLogging(slaveInfo), MesosUtils.formatForLogging(frameworkInfo)); }
@Override public synchronized void executorLost(SchedulerDriver schedulerDriver, ExecutorID executorID, SlaveID slaveID, int status) { LOG.warn("Executor " + executorID.getValue() + " lost with status " + status + " on slave " + slaveID); }
/** * Returns the embedded de-slashed service name, or an empty Optional if no service name was found. The returned * value will omit any slashes which may have been present in the original service name. Service names are only * embedded in executor IDs as of SDK 0.50. * <p> * For example: "path.to.service__instance-0__aoeu5678" => "path.to.service" (NOT "/path/to/service"), * or "instance-0__aoeu5678" => Empty * * @see #toExecutorId(String) */ public static Optional<String> toSanitizedServiceName( Protos.ExecutorID executorId) throws TaskException { return extractServiceNameFromId(executorId.getValue()); }
@Override public void executorLost(final SchedulerDriver driver, final Protos.ExecutorID executorId, final Protos.SlaveID slaveId, final int status) { final String diagnostics = "Executor Lost. executorid: "+executorId.getValue()+" slaveid: "+slaveId.getValue(); final ResourceStatusEvent resourceStatus = ResourceStatusEventImpl.newBuilder() .setIdentifier(executorId.getValue()) .setState(State.FAILED) .setExitCode(status) .setDiagnostics(diagnostics) .build(); this.reefEventHandlers.onResourceStatus(resourceStatus); }
@Override public void executorLost( SchedulerDriver driver, Protos.ExecutorID executorId, Protos.SlaveID agentId, int status) { try { LOGGER.warn("Lost Executor: {} on Agent: {}", executorId.getValue(), agentId.getValue()); } catch (Throwable e) { logExceptionAndExit(e); } }
/** * Pretty-print mesos protobuf TaskInfo. * <p/> * XXX(erikdw): not including command, container (+data), nor health_check. */ public static String taskInfoToString(TaskInfo task) { Map<String, String> map = new LinkedHashMap<>(); map.put("task_id", task.getTaskId().getValue()); map.put("slave_id", task.getSlaveId().getValue()); map.putAll(resourcesToOrderedMap(task.getResourcesList())); map.put("executor_id", task.getExecutor().getExecutorId().getValue()); return JSONValue.toJSONString(map); }
/** * Gets the executors id. * * @return The universally unique identifier for the executor. */ public String getId() { return info.getExecutorId().getValue(); }
@Override public void executorLost(SchedulerDriver driver, Protos.ExecutorID executorId, Protos.SlaveID slaveId, int status) { LOGGER.info("Executor lost: executorId: {} slaveId: {} status: {}", executorId.getValue(), slaveId.getValue(), status); }
@Override public synchronized void executorLost(SchedulerDriver schedulerDriver, ExecutorID executorID, SlaveID slaveID, int status) { LOG.warn("Executor " + executorID.getValue() + " lost with status " + status + " on slave " + slaveID); }
@Override public void frameworkMessage(SchedulerDriver driver, Protos.ExecutorID executorId, Protos.SlaveID slaveId, byte[] data) { LOGGER.info("Framework message: executorId={} slaveId={} data='{}'", executorId.getValue(), slaveId.getValue(), Arrays.toString(data)); }
@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(); }
@Override public void frameworkMessage( SchedulerDriver driver, Protos.ExecutorID executorId, Protos.SlaveID agentId, byte[] data) { try { LOGGER.error("Received unsupported {} byte Framework Message from Executor {} on Agent {}", data.length, executorId.getValue(), agentId.getValue()); } catch (Throwable e) { logExceptionAndExit(e); } }
/** * Converts the unique {@link Protos.ExecutorID} into a Framework defined executor name. * <p> * For example: "path.to.service__instance-0__aoeu5678" => "instance-0" * * @see #toExecutorId(String) */ public static String toExecutorName(Protos.ExecutorID executorId) throws TaskException { return extractTaskNameFromId(executorId.getValue()); }
@Override public synchronized void frameworkMessage(SchedulerDriver schedulerDriver, ExecutorID executorID, SlaveID slaveID, byte[] bytes) { LOG.info("Framework Message of " + bytes.length + " bytes" + " from executor " + executorID.getValue() + " on slave " + slaveID.getValue()); }
@Override public void executorLost(SchedulerDriver driver, ExecutorID executor, SlaveID slave, int status) { LOG.warn("Mesos Executor lost: executor: {} slave: {} status: {}", executor.getValue(), slave.getValue(), status); } }
@Test public void testFoldered2ToExecutorId() throws Exception { Protos.ExecutorID executorId = CommonIdUtils.toExecutorId(TEST_FOLDERED_SERVICE_NAME2, TEST_TASK_NAME); Assert.assertTrue(executorId.getValue().startsWith(TEST_FOLDERED_SANITIZED_NAME + "__" + TEST_TASK_NAME + "__")); Assert.assertNotNull(UUID.fromString(executorId.getValue().split("__")[2])); Assert.assertEquals(TEST_TASK_NAME, CommonIdUtils.toExecutorName(executorId)); Assert.assertEquals(TEST_FOLDERED_SANITIZED_NAME, CommonIdUtils.toSanitizedServiceName(executorId).get()); }
@Test public void testToExecutorId() throws Exception { Protos.ExecutorID executorId = CommonIdUtils.toExecutorId(TEST_SERVICE_NAME, TEST_TASK_NAME); Assert.assertTrue(executorId.getValue().startsWith(TEST_SERVICE_NAME + "__" + TEST_TASK_NAME + "__")); Assert.assertNotNull(UUID.fromString(executorId.getValue().split("__")[2])); Assert.assertEquals(TEST_TASK_NAME, CommonIdUtils.toExecutorName(executorId)); Assert.assertEquals(TEST_SERVICE_NAME, CommonIdUtils.toSanitizedServiceName(executorId).get()); }
@Test public void testFoldered1ToExecutorId() throws Exception { Protos.ExecutorID executorId = CommonIdUtils.toExecutorId(TEST_FOLDERED_SERVICE_NAME, TEST_TASK_NAME); Assert.assertTrue(executorId.getValue().startsWith(TEST_FOLDERED_SANITIZED_NAME + "__" + TEST_TASK_NAME + "__")); Assert.assertNotNull(UUID.fromString(executorId.getValue().split("__")[2])); Assert.assertEquals(TEST_TASK_NAME, CommonIdUtils.toExecutorName(executorId)); Assert.assertEquals(TEST_FOLDERED_SANITIZED_NAME, CommonIdUtils.toSanitizedServiceName(executorId).get()); }
@Override public synchronized void frameworkMessage(SchedulerDriver schedulerDriver, ExecutorID executorID, SlaveID slaveID, byte[] bytes) { LOG.info("Framework Message of " + bytes.length + " bytes" + " from executor " + executorID.getValue() + " on slave " + slaveID.getValue()); }