@Override public synchronized void submit(final EvaluatorRequest req) { LOG.log( Level.FINEST, "Got an EvaluatorRequest: number: {0}, memory = {1}, cores = {2}.", new Object[] {req.getNumber(), req.getMegaBytes(), req.getNumberOfCores()}); if (req.getMegaBytes() <= 0) { throw new IllegalArgumentException("Given an unsupported memory size: " + req.getMegaBytes()); } if (req.getNumberOfCores() <= 0) { throw new IllegalArgumentException( "Given an unsupported core number: " + req.getNumberOfCores()); } if (req.getNumber() <= 0) { throw new IllegalArgumentException( "Given an unsupported number of evaluators: " + req.getNumber()); } if (req.getNodeNames() == null) { throw new IllegalArgumentException("Node names cannot be null"); } if (req.getRackNames() == null) { throw new IllegalArgumentException("Rack names cannot be null"); } try (LoggingScope ls = loggingScopeFactory.evaluatorSubmit(req.getNumber())) { final ResourceRequestEvent request = ResourceRequestEventImpl.newBuilder() .setResourceCount(req.getNumber()) .setVirtualCores(req.getNumberOfCores()) .setMemorySize(req.getMegaBytes()) .addNodeNames(req.getNodeNames()) .addRackNames(req.getRackNames()) .build(); this.resourceRequestHandler.onNext(request); } }
@Override public void onNext(final StartTime time) { FailDriver.this.checkMsgOrder(time); FailDriver.this.requestor.submit( EvaluatorRequest.newBuilder().setNumber(1).setMemory(128).setNumberOfCores(1).build()); }
@Override public synchronized void submit(final EvaluatorRequest req) { LOG.log( Level.FINEST, "Got an EvaluatorRequest: number: {0}, memory = {1}, cores = {2}.", new Object[] {req.getNumber(), req.getMegaBytes(), req.getNumberOfCores()}); if (req.getMegaBytes() <= 0) { throw new IllegalArgumentException("Given an unsupported memory size: " + req.getMegaBytes()); } if (req.getNumberOfCores() <= 0) { throw new IllegalArgumentException( "Given an unsupported core number: " + req.getNumberOfCores()); } if (req.getNumber() <= 0) { throw new IllegalArgumentException( "Given an unsupported number of evaluators: " + req.getNumber()); } if (req.getNodeNames() == null) { throw new IllegalArgumentException("Node names cannot be null"); } if (req.getRackNames() == null) { throw new IllegalArgumentException("Rack names cannot be null"); } if (req.getRuntimeName() == null) { throw new IllegalArgumentException("Runtime name cannot be null"); } // for backwards compatibility, we will always set the relax locality flag // to true unless the user configured racks, in which case we will check for // the ANY modifier (*), if not there, then we won't relax the locality boolean relaxLocality = true; if (!req.getRackNames().isEmpty()) { for (final String rackName : req.getRackNames()) { if (Constants.ANY_RACK.equals(rackName)) { relaxLocality = true; break; } relaxLocality = false; } } // if the user specified any node, then we assume they do not want to relax locality if (!req.getNodeNames().isEmpty()) { relaxLocality = false; } try (LoggingScope ls = loggingScopeFactory.evaluatorSubmit(req.getNumber())) { final ResourceRequestEvent request = ResourceRequestEventImpl.newBuilder() .setResourceCount(req.getNumber()) .setVirtualCores(req.getNumberOfCores()) .setMemorySize(req.getMegaBytes()) .addNodeNames(req.getNodeNames()) .addRackNames(req.getRackNames()) .setRelaxLocality(relaxLocality) .setRuntimeName(req.getRuntimeName()) .build(); this.resourceRequestHandler.onNext(request); } }