org.apache.reef.driver.evaluator.EvaluatorDescriptor Java Examples

The following examples show how to use org.apache.reef.driver.evaluator.EvaluatorDescriptor. 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: ContextFactory.java    From reef with Apache License 2.0 6 votes vote down vote up
@Inject
ContextFactory(@Parameter(EvaluatorManager.EvaluatorIdentifier.class) final String evaluatorId,
               @Parameter(EvaluatorManager.EvaluatorDescriptorName.class)
               final EvaluatorDescriptor evaluatorDescriptor,
               final ConfigurationSerializer configurationSerializer,
               final ExceptionCodec exceptionCodec,
               final EvaluatorMessageDispatcher messageDispatcher,
               final ContextControlHandler contextControlHandler,
               final InjectionFuture<ContextRepresenters> contextRepresenters) {
  this.evaluatorId = evaluatorId;
  this.evaluatorDescriptor = evaluatorDescriptor;
  this.configurationSerializer = configurationSerializer;
  this.exceptionCodec = exceptionCodec;
  this.messageDispatcher = messageDispatcher;
  this.contextControlHandler = contextControlHandler;
  this.contextRepresenters = contextRepresenters;
}
 
Example #2
Source File: SuspendDriver.java    From reef with Apache License 2.0 6 votes vote down vote up
@Override
public void onNext(final CompletedTask task) {

  final EvaluatorDescriptor e = task.getActiveContext().getEvaluatorDescriptor();
  final String msg = "Task completed " + task.getId() + " on node " + e;
  LOG.info(msg);

  jobMessageObserver.sendMessageToClient(CODEC_STR.encode(msg));
  runningTasks.remove(task.getId());
  task.getActiveContext().close();

  final boolean noTasks;

  synchronized (suspendedTasks) {
    LOG.log(Level.INFO, "Tasks running: {0} suspended: {1}", new Object[]{
        runningTasks.size(), suspendedTasks.size()});
    noTasks = runningTasks.isEmpty() && suspendedTasks.isEmpty();
  }

  if (noTasks) {
    LOG.info("All tasks completed; shutting down.");
  }
}
 
Example #3
Source File: EvaluatorContext.java    From reef with Apache License 2.0 6 votes vote down vote up
public EvaluatorContext(final String contextIdentifier,
                        final String evaluatorIdentifier,
                        final EvaluatorDescriptor evaluatorDescriptor,
                        final Optional<String> parentID,
                        final ConfigurationSerializer configurationSerializer,
                        final ContextControlHandler contextControlHandler,
                        final EvaluatorMessageDispatcher messageDispatcher,
                        final ExceptionCodec exceptionCodec,
                        final ContextRepresenters contextRepresenters) {

  this.contextIdentifier = contextIdentifier;
  this.evaluatorIdentifier = evaluatorIdentifier;
  this.evaluatorDescriptor = evaluatorDescriptor;
  this.parentID = parentID;
  this.configurationSerializer = configurationSerializer;
  this.contextControlHandler = contextControlHandler;
  this.exceptionCodec = exceptionCodec;
  this.contextRepresenters = contextRepresenters;

  LOG.log(Level.FINE, "Instantiated 'EvaluatorContext'");
}
 
Example #4
Source File: TestReefEventStateManager.java    From reef with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() throws InjectionException {
  final Tang tang = Tang.Factory.getTang();

  final Configuration configuration = tang.newConfigurationBuilder()
      .bindImplementation(EvaluatorDescriptor.class, MockEvaluatorDescriptor.class)
      .bindImplementation(NodeDescriptor.class, MockNodeDescriptor.class)
      .bindImplementation(EvaluatorProcessFactory.class, CLRProcessFactory.class)
      .bindNamedParameter(RemoteConfiguration.ManagerName.class, "REEF_TEST_REMOTE_MANAGER")
      .bindNamedParameter(RemoteConfiguration.MessageCodec.class, REEFMessageCodec.class)
      .bindNamedParameter(JobIdentifier.class, "my job")
      .build();

  injector = tang.newInjector(configuration);
  reefEventStateManager = injector.getInstance(ReefEventStateManager.class);
}
 
Example #5
Source File: TestAvroSerializerForHttp.java    From reef with Apache License 2.0 6 votes vote down vote up
@Test
public void evaluatorListSerializerInjectionTest() {
  try {
    final EvaluatorListSerializer serializer =
        Tang.Factory.getTang().newInjector().getInstance(EvaluatorListSerializer.class);

    final List<String> ids = new ArrayList<>();
    ids.add("abc");
    final EvaluatorDescriptor evaluatorDescriptor =
        Tang.Factory.getTang().newInjector(EvaluatorDescriptorConfig.CONF.build())
            .getInstance(EvaluatorDescriptor.class);
    final Map<String, EvaluatorDescriptor> data = new HashMap<>();
    data.put("abc", evaluatorDescriptor);

    final AvroEvaluatorList evaluatorList = serializer.toAvro(data, 1, "xxxxxx");
    final String evaluatorListString = serializer.toString(evaluatorList);
    Assert.assertEquals(evaluatorListString,
        "{\"evaluators\":[{\"id\":\"abc\",\"name\":\"mock\"}],\"total\":1,\"startTime\":\"xxxxxx\"}");
  } catch (final InjectionException e) {
    Assert.fail("Not able to inject EvaluatorListSerializer");
  }
}
 
Example #6
Source File: TestAvroSerializerForHttp.java    From reef with Apache License 2.0 6 votes vote down vote up
@Test
public void evaluatorInfoSerializerInjectionTest() {
  try {
    final EvaluatorInfoSerializer serializer =
        Tang.Factory.getTang().newInjector().getInstance(EvaluatorInfoSerializer.class);

    final List<String> ids = new ArrayList<>();
    ids.add("abc");
    final EvaluatorDescriptor evaluatorDescriptor =
        Tang.Factory.getTang().newInjector(EvaluatorDescriptorConfig.CONF.build())
            .getInstance(EvaluatorDescriptor.class);
    final Map<String, EvaluatorDescriptor> data = new HashMap<>();
    data.put("abc", evaluatorDescriptor);

    final AvroEvaluatorsInfo evaluatorInfo = serializer.toAvro(ids, data);
    final String evaluatorInfoString = serializer.toString(evaluatorInfo);
    Assert.assertEquals(evaluatorInfoString, "{\"evaluatorsInfo\":[{\"evaluatorId\":\"abc\",\"nodeId\":\"\"," +
        "\"nodeName\":\"mock\",\"memory\":64,\"type\":\"CLR\",\"internetAddress\":\"\",\"runtimeName\":\"Local\"}]}");
  } catch (final InjectionException e) {
    Assert.fail("Not able to inject EvaluatorInfoSerializer");
  }
}
 
Example #7
Source File: AvroEvaluatorListSerializer.java    From reef with Apache License 2.0 6 votes vote down vote up
/**
 * Build AvroEvaluatorList object.
 */
@Override
public AvroEvaluatorList toAvro(
    final Map<String, EvaluatorDescriptor> evaluatorMap,
    final int totalEvaluators, final String startTime) {

  final List<AvroEvaluatorEntry> evaluatorEntities = new ArrayList<>();

  for (final Map.Entry<String, EvaluatorDescriptor> entry : evaluatorMap.entrySet()) {
    final EvaluatorDescriptor descriptor = entry.getValue();
    evaluatorEntities.add(AvroEvaluatorEntry.newBuilder()
            .setId(entry.getKey())
            .setName(descriptor.getNodeDescriptor().getName())
            .build());
  }

  return AvroEvaluatorList.newBuilder()
      .setEvaluators(evaluatorEntities)
      .setTotal(totalEvaluators)
      .setStartTime(startTime != null ? startTime : new Date().toString())
      .build();
}
 
Example #8
Source File: HttpServerReefEventHandler.java    From reef with Apache License 2.0 6 votes vote down vote up
/**
 * Get all evaluator ids and send it back to response so that can be displayed on web.
 *
 * @param response
 * @throws IOException
 */
private void writeEvaluatorsWebOutput(final HttpServletResponse response) throws IOException {

  LOG.log(Level.INFO, "HttpServerReefEventHandler writeEvaluatorsWebOutput is called");

  final PrintWriter writer = response.getWriter();

  writer.println("<h1>Evaluators:</h1>");

  for (final Map.Entry<String, EvaluatorDescriptor> entry
      : this.reefStateManager.getEvaluators().entrySet()) {

    final String key = entry.getKey();
    final EvaluatorDescriptor descriptor = entry.getValue();

    writer.println("Evaluator Id: " + key);
    writer.write("<br/>");
    writer.println("Evaluator Name: " + descriptor.getNodeDescriptor().getName());
    writer.write("<br/>");
  }
  writer.write("<br/>");
  writer.println("Total number of Evaluators: " + this.reefStateManager.getEvaluators().size());
  writer.write("<br/>");
  writer.println(String.format("Driver Start Time:[%s]", this.reefStateManager.getStartTime()));
}
 
Example #9
Source File: GRPCUtils.java    From reef with Apache License 2.0 6 votes vote down vote up
/**
 * Create an evaluator descriptor info from an EvalautorDescriptor object.
 * @param descriptor object
 * @return EvaluatorDescriptorInfo
 */
public static EvaluatorDescriptorInfo toEvaluatorDescriptorInfo(
    final EvaluatorDescriptor descriptor) {
  if (descriptor == null) {
    return null;
  }
  EvaluatorDescriptorInfo.NodeDescriptorInfo nodeDescriptorInfo = descriptor.getNodeDescriptor() == null ? null :
      EvaluatorDescriptorInfo.NodeDescriptorInfo.newBuilder()
          .setHostName(descriptor.getNodeDescriptor().getName())
          .setId(descriptor.getNodeDescriptor().getId())
          .setIpAddress(descriptor.getNodeDescriptor().getInetSocketAddress().getAddress().getHostAddress())
          .setPort(descriptor.getNodeDescriptor().getInetSocketAddress().getPort())
          .setRackName(descriptor.getNodeDescriptor().getRackDescriptor() == null ?
              "" : descriptor.getNodeDescriptor().getRackDescriptor().getName())
          .build();
  return EvaluatorDescriptorInfo.newBuilder()
      .setCores(descriptor.getNumberOfCores())
      .setMemory(descriptor.getMemory())
      .setRuntimeName(descriptor.getRuntimeName())
      .setNodeDescriptorInfo(nodeDescriptorInfo)
      .build();
}
 
Example #10
Source File: HttpServerReefEventHandler.java    From reef with Apache License 2.0 5 votes vote down vote up
/**
 * Write Evaluator info on the Response so that to display on web page directly.
 * This is for direct browser queries.
 */
private void writeEvaluatorInfoWebOutput(
    final HttpServletResponse response, final List<String> ids) throws IOException {

  for (final String id : ids) {

    final EvaluatorDescriptor evaluatorDescriptor = this.reefStateManager.getEvaluators().get(id);
    final PrintWriter writer = response.getWriter();

    if (evaluatorDescriptor != null) {
      final String nodeId = evaluatorDescriptor.getNodeDescriptor().getId();
      final String nodeName = evaluatorDescriptor.getNodeDescriptor().getName();
      final InetSocketAddress address =
          evaluatorDescriptor.getNodeDescriptor().getInetSocketAddress();

      writer.println("Evaluator Id: " + id);
      writer.write("<br/>");
      writer.println("Evaluator Node Id: " + nodeId);
      writer.write("<br/>");
      writer.println("Evaluator Node Name: " + nodeName);
      writer.write("<br/>");
      writer.println("Evaluator InternetAddress: " + address);
      writer.write("<br/>");
      writer.println("Evaluator Memory: " + evaluatorDescriptor.getMemory());
      writer.write("<br/>");
      writer.println("Evaluator Core: " + evaluatorDescriptor.getNumberOfCores());
      writer.write("<br/>");
      writer.println("Evaluator Type: " + evaluatorDescriptor.getProcess());
      writer.write("<br/>");
      writer.println("Evaluator Runtime Name: " + evaluatorDescriptor.getRuntimeName());
      writer.write("<br/>");
    } else {
      writer.println("Incorrect Evaluator Id: " + id);
    }
  }
}
 
Example #11
Source File: ClosedContextImpl.java    From reef with Apache License 2.0 5 votes vote down vote up
/**
 * @param parentContext       the parent context.
 * @param contextID           the id of the closed context
 * @param evaluatorId         the id of the evaluator on which the context was closed
 * @param evaluatorDescriptor the descriptor of the evaluator on which the context was closed.
 */
public ClosedContextImpl(final ActiveContext parentContext,
                         final String contextID,
                         final String evaluatorId,
                         final EvaluatorDescriptor evaluatorDescriptor) {
  this.parentContext = parentContext;
  this.contextID = contextID;
  this.evaluatorId = evaluatorId;
  this.evaluatorDescriptor = evaluatorDescriptor;
}
 
Example #12
Source File: ActiveContextBridge.java    From reef with Apache License 2.0 5 votes vote down vote up
public ActiveContextBridge(
    final DriverServiceClient driverServiceClient,
    final String contextId,
    final Optional<String> parentId,
    final String evaluatorId,
    final EvaluatorDescriptor evaluatorDescriptor) {
  this.driverServiceClient = driverServiceClient;
  this.contextId = contextId;
  this.parentId = parentId;
  this.evaluatorId = evaluatorId;
  this.evaluatorDescriptor = evaluatorDescriptor;
}
 
Example #13
Source File: FailedContextBridge.java    From reef with Apache License 2.0 5 votes vote down vote up
public FailedContextBridge(
    final String contextId,
    final String evaluatorId,
    final String message,
    final EvaluatorDescriptor evaluatorDescriptor,
    final Optional<ActiveContext> parentContext,
    final Optional<Throwable> reason) {
  this.contextId = contextId;
  this.evaluatorId = evaluatorId;
  this.message = message;
  this.evaluatorDescriptor = evaluatorDescriptor;
  this.parentContext = parentContext;
  this.reason = reason;
}
 
Example #14
Source File: AllocatedEvaluatorBridge.java    From reef with Apache License 2.0 5 votes vote down vote up
public AllocatedEvaluatorBridge(
    final String evaluatorId,
    final EvaluatorDescriptor evaluatorDescriptor,
    final DriverServiceClient driverServiceClient) {
  this.evaluatorId = evaluatorId;
  this.evaluatorDescriptor = evaluatorDescriptor;
  this.driverServiceClient = driverServiceClient;
}
 
Example #15
Source File: ClosedContextBridge.java    From reef with Apache License 2.0 5 votes vote down vote up
public ClosedContextBridge(
    final String contextId,
    final String evaluatorId,
    final ActiveContext parentContext,
    final EvaluatorDescriptor evaluatorDescriptor) {
  this.contextId = contextId;
  this.evaluatorId = evaluatorId;
  this.parentContext = parentContext;
  this.evaluatorDescriptor = evaluatorDescriptor;
}
 
Example #16
Source File: ContainerManagerTest.java    From incubator-nemo with Apache License 2.0 5 votes vote down vote up
@Test
public void testRequestAllocateLaunch() {
  // Create 2 of A, 2 of B and 1 of C.
  final Map<Integer, ResourceSpecification> numToSpec = new HashMap();
  numToSpec.put(2, RESOURCE_SPEC_A);
  numToSpec.put(2, RESOURCE_SPEC_B);
  numToSpec.put(1, RESOURCE_SPEC_C);

  // Request -> Allocate -> Launch
  for (final Map.Entry<Integer, ResourceSpecification> entry : numToSpec.entrySet()) {
    final int num = entry.getKey();
    final ResourceSpecification spec = entry.getValue();
    containerManager.requestContainer(num, spec);

    for (int i = 0; i < num; i++) {
      final String evaluatorId = getEvaluatorId();
      final String executorId = getExecutorId();
      final EvaluatorDescriptor descriptor = createDescriptor(spec);

      containerManager.onContainerAllocated(
        executorId,
        createMockEvaluator(evaluatorId, descriptor),
        createMockConfiguration());
      final ExecutorRepresenter executorRepresenter =
        containerManager.onContainerLaunched(createMockContext(executorId, descriptor)).get();
      assertEquals(spec.getContainerType(), executorRepresenter.getContainerType());
      assertEquals(spec.getCapacity(), executorRepresenter.getExecutorCapacity());
      assertEquals(descriptor.getNodeDescriptor().getName(), executorRepresenter.getNodeName());
    }
  }
}
 
Example #17
Source File: TestReefEventStateManager.java    From reef with Apache License 2.0 5 votes vote down vote up
@Test
public void addEvaluatorTest() throws InjectionException {
  final EvaluatorDescriptor evaluatorDescriptor = injector.getInstance(MockEvaluatorDescriptor.class);
  reefEventStateManager.put("1234", evaluatorDescriptor);
  final Map<String, EvaluatorDescriptor> evaluators = reefEventStateManager.getEvaluators();
  Assert.assertEquals(1, evaluators.size());
}
 
Example #18
Source File: TestReefEventStateManager.java    From reef with Apache License 2.0 5 votes vote down vote up
@Test
public void getEvaluatorNodeDescriptorTest() throws InjectionException {
  final EvaluatorDescriptor evaluatorDescriptor = injector.getInstance(MockEvaluatorDescriptor.class);
  reefEventStateManager.put("1234", evaluatorDescriptor);
  final NodeDescriptor nodeDescriptor = reefEventStateManager.getEvaluatorNodeDescriptor("1234");
  Assert.assertEquals("myKey", nodeDescriptor.getId());
}
 
Example #19
Source File: TestReefEventStateManager.java    From reef with Apache License 2.0 5 votes vote down vote up
@Test
public void getEvaluatorDescriptorTest() throws InjectionException {
  final EvaluatorDescriptor evaluatorDescriptor = injector.getInstance(MockEvaluatorDescriptor.class);
  reefEventStateManager.put("1234", evaluatorDescriptor);
  final EvaluatorDescriptor evaluatorDescriptor1 = reefEventStateManager.getEvaluatorDescriptor("1234");
  Assert.assertEquals(evaluatorDescriptor, evaluatorDescriptor1);
}
 
Example #20
Source File: MockAllocatedEvaluator.java    From reef with Apache License 2.0 5 votes vote down vote up
MockAllocatedEvaluator(
    final MockRuntimeDriver mockRuntimeDriver,
    final String identifier,
    final EvaluatorDescriptor evaluatorDescriptor) {
  this.mockRuntimeDriver = mockRuntimeDriver;
  this.identifier = identifier;
  this.evaluatorDescriptor = evaluatorDescriptor;
}
 
Example #21
Source File: FailedContextImpl.java    From reef with Apache License 2.0 5 votes vote down vote up
/**
 * @param id                  Identifier of the entity that produced the error.
 * @param message             One-line error message.
 * @param description         Long error description.
 * @param cause               Java Exception that caused the error.
 * @param data                byte array that contains serialized version of the error.
 * @param parentContext       the parent context, if there is one.
 * @param evaluatorDescriptor the descriptor of the Evaluator this context failed on.
 * @param evaluatorID         the id of the Evaluator this context failed on.
 */
public FailedContextImpl(final String id,
                         final String message,
                         final Optional<String> description,
                         final Optional<Throwable> cause,
                         final Optional<byte[]> data,
                         final Optional<ActiveContext> parentContext,
                         final EvaluatorDescriptor evaluatorDescriptor,
                         final String evaluatorID) {
  super(id, message, description, cause, data);
  this.parentContext = parentContext;
  this.evaluatorDescriptor = evaluatorDescriptor;
  this.evaluatorID = evaluatorID;
}
 
Example #22
Source File: HeronMasterDriverTest.java    From incubator-heron with Apache License 2.0 5 votes vote down vote up
private AllocatedEvaluator createMockEvaluator(String evaluatorId, int cores, ByteAmount mem) {
  EvaluatorDescriptor descriptor = mock(EvaluatorDescriptor.class);
  when(descriptor.getMemory()).thenReturn(((Long) mem.asMegabytes()).intValue());
  when(descriptor.getNumberOfCores()).thenReturn(cores);
  AllocatedEvaluator mockEvaluator = mock(AllocatedEvaluator.class);
  when(mockEvaluator.getEvaluatorDescriptor()).thenReturn(descriptor);
  when(mockEvaluator.getId()).thenReturn(evaluatorId);
  return mockEvaluator;
}
 
Example #23
Source File: HeronMasterDriverTest.java    From incubator-heron with Apache License 2.0 5 votes vote down vote up
private void verifyFittingContainer(Set<HeronMasterDriver.HeronWorker> containers,
                                    int ram,
                                    int cores,
                                    int expectedContainer) {
  EvaluatorDescriptor evaluatorDescriptor = mock(EvaluatorDescriptor.class);
  AllocatedEvaluator mockEvaluator = mock(AllocatedEvaluator.class);
  when(mockEvaluator.getEvaluatorDescriptor()).thenReturn(evaluatorDescriptor);

  when(evaluatorDescriptor.getMemory()).thenReturn(ram);
  when(evaluatorDescriptor.getNumberOfCores()).thenReturn(cores);
  Optional<HeronMasterDriver.HeronWorker> worker =
      spyDriver.findLargestFittingWorker(mockEvaluator, containers, false);
  assertTrue(worker.isPresent());
  assertEquals(expectedContainer, worker.get().getWorkerId());
}
 
Example #24
Source File: HeronMasterDriver.java    From incubator-heron with Apache License 2.0 5 votes vote down vote up
@Override
public void onNext(AllocatedEvaluator evaluator) {
  EvaluatorDescriptor descriptor = evaluator.getEvaluatorDescriptor();
  LOG.log(Level.INFO, String.format("New container received, id: %s, mem: %d, cores: %d",
      evaluator.getId(), descriptor.getMemory(), descriptor.getNumberOfCores()));

  Optional<HeronWorker> result;
  HeronWorker worker;
  synchronized (containerPlans) {
    Set<HeronWorker> workersAwaitingAllocation = getWorkersAwaitingAllocation();

    if (workersAwaitingAllocation.isEmpty()) {
      LOG.log(Level.INFO, "Could not find any workers waiting for allocation, closing {0}",
          evaluator.getId());
      evaluator.close();
      return;
    }

    result = findLargestFittingWorker(evaluator, workersAwaitingAllocation, true);
    if (!result.isPresent()) {
      LOG.warning("Could not find a fitting worker in awaiting workers");
      // TODO may need counting of missed allocation
      evaluator.close();
      return;
    }

    worker = result.get();
    LOG.info(String.format("Worker:%d, cores:%d, mem:%s fits in the allocated container",
        worker.workerId, worker.cores, worker.mem));
    workersAwaitingAllocation.remove(worker);
    multiKeyWorkerMap.assignEvaluatorToWorker(worker, evaluator);
  }

  LOG.log(Level.INFO, "Activating container {0} for heron worker, id: {1}",
      new Object[]{evaluator.getId(), worker.workerId});
  Configuration context = createContextConfig(worker.workerId);
  evaluator.submitContext(context);
}
 
Example #25
Source File: ContainerManagerTest.java    From incubator-nemo with Apache License 2.0 5 votes vote down vote up
private ActiveContext createMockContext(final String id,
                                        final EvaluatorDescriptor descriptor) {
  final ActiveContext mockedContext = mock(ActiveContext.class);
  when(mockedContext.getId()).thenReturn(id);
  when(mockedContext.getEvaluatorDescriptor()).thenReturn(descriptor);
  return mockedContext;
}
 
Example #26
Source File: ContainerManagerTest.java    From incubator-nemo with Apache License 2.0 5 votes vote down vote up
private AllocatedEvaluator createMockEvaluator(final String id,
                                               final EvaluatorDescriptor descriptor) {
  final AllocatedEvaluator evaluator = mock(AllocatedEvaluator.class);
  when(evaluator.getId()).thenReturn(id);
  when(evaluator.getEvaluatorDescriptor()).thenReturn(descriptor);
  return evaluator;
}
 
Example #27
Source File: ContainerManagerTest.java    From incubator-nemo with Apache License 2.0 5 votes vote down vote up
private EvaluatorDescriptor createDescriptor(final ResourceSpecification spec) {
  final EvaluatorDescriptor descriptor = mock(EvaluatorDescriptor.class);
  when(descriptor.getMemory()).thenReturn(spec.getMemory());
  when(descriptor.getNumberOfCores()).thenReturn(spec.getCapacity());

  final NodeDescriptor node = mock(NodeDescriptor.class);
  when(node.getName()).thenReturn(getNodeName());
  when(descriptor.getNodeDescriptor()).thenReturn(node);
  return descriptor;
}
 
Example #28
Source File: ContainerManagerTest.java    From incubator-nemo with Apache License 2.0 5 votes vote down vote up
@Test
public void testFailureAfterLaunch() {
  containerManager.requestContainer(1, RESOURCE_SPEC_A);
  final String evaluatorId = getEvaluatorId();
  final String executorId = getExecutorId();
  final EvaluatorDescriptor descriptor = createDescriptor(RESOURCE_SPEC_A);

  containerManager.onContainerAllocated(
    executorId,
    createMockEvaluator(evaluatorId, descriptor),
    createMockConfiguration());
  containerManager.onContainerLaunched(createMockContext(executorId, descriptor));
  assertEquals(RESOURCE_SPEC_A, containerManager.onContainerFailed(evaluatorId));
}
 
Example #29
Source File: EvaluatorDescriptorImpl.java    From reef with Apache License 2.0 5 votes vote down vote up
@Override
public EvaluatorDescriptorBuilder newBuilder(final EvaluatorDescriptor copy) {
  return newBuilder()
      .setNodeDescriptor(copy.getNodeDescriptor())
      .setMemory(copy.getMemory())
      .setNumberOfCores(copy.getNumberOfCores())
      .setEvaluatorProcess(copy.getProcess())
      .setRuntimeName(copy.getRuntimeName());
}
 
Example #30
Source File: EvaluatorDescriptorImpl.java    From reef with Apache License 2.0 5 votes vote down vote up
@Override
public EvaluatorDescriptor build() {
  if (this.memory == 0) {
    throw new IllegalArgumentException("memory not set");
  } else if (this.numberOfCores == 0) {
    throw new IllegalArgumentException("number of cores not set");
  }
  return new EvaluatorDescriptorImpl(
      this.nodeDescriptor,
      this.memory,
      this.numberOfCores,
      this.evaluatorProcess,
      this.runtimeName);
}