@Override public CompletableFuture<Collection<SlotOffer>> offerSlots( final ResourceID taskManagerId, final Collection<SlotOffer> slots, final Time timeout) { Tuple2<TaskManagerLocation, TaskExecutorGateway> taskManager = registeredTaskManagers.get(taskManagerId); if (taskManager == null) { return FutureUtils.completedExceptionally(new Exception("Unknown TaskManager " + taskManagerId)); } final TaskManagerLocation taskManagerLocation = taskManager.f0; final TaskExecutorGateway taskExecutorGateway = taskManager.f1; final RpcTaskManagerGateway rpcTaskManagerGateway = new RpcTaskManagerGateway(taskExecutorGateway, getFencingToken()); return slotPoolGateway.offerSlots( taskManagerLocation, rpcTaskManagerGateway, slots); }
@Override public CompletableFuture<Collection<SlotOffer>> offerSlots( final ResourceID taskManagerId, final Collection<SlotOffer> slots, final Time timeout) { Tuple2<TaskManagerLocation, TaskExecutorGateway> taskManager = registeredTaskManagers.get(taskManagerId); if (taskManager == null) { return FutureUtils.completedExceptionally(new Exception("Unknown TaskManager " + taskManagerId)); } final TaskManagerLocation taskManagerLocation = taskManager.f0; final TaskExecutorGateway taskExecutorGateway = taskManager.f1; final RpcTaskManagerGateway rpcTaskManagerGateway = new RpcTaskManagerGateway(taskExecutorGateway, getFencingToken()); return slotPoolGateway.offerSlots( taskManagerLocation, rpcTaskManagerGateway, slots); }
@Override public CompletableFuture<Collection<SlotOffer>> offerSlots( final ResourceID taskManagerId, final Collection<SlotOffer> slots, final Time timeout) { Tuple2<TaskManagerLocation, TaskExecutorGateway> taskManager = registeredTaskManagers.get(taskManagerId); if (taskManager == null) { return FutureUtils.completedExceptionally(new Exception("Unknown TaskManager " + taskManagerId)); } final TaskManagerLocation taskManagerLocation = taskManager.f0; final TaskExecutorGateway taskExecutorGateway = taskManager.f1; final RpcTaskManagerGateway rpcTaskManagerGateway = new RpcTaskManagerGateway(taskExecutorGateway, getFencingToken()); return slotPoolGateway.offerSlots( taskManagerLocation, rpcTaskManagerGateway, slots); }
@RpcMethod public Future<Iterable<SlotOffer>> offerSlots( final ResourceID taskManagerId, final Iterable<SlotOffer> slots, final UUID leaderId) throws Exception { validateLeaderSessionId(leaderId); Tuple2<TaskManagerLocation, TaskExecutorGateway> taskManager = registeredTaskManagers.get(taskManagerId); if (taskManager == null) { throw new Exception("Unknown TaskManager " + taskManagerId); } final JobID jid = jobGraph.getJobID(); final TaskManagerLocation taskManagerLocation = taskManager.f0; final TaskExecutorGateway taskExecutorGateway = taskManager.f1; final ArrayList<Tuple2<AllocatedSlot, SlotOffer>> slotsAndOffers = new ArrayList<>(); final RpcTaskManagerGateway rpcTaskManagerGateway = new RpcTaskManagerGateway(taskExecutorGateway, leaderId); for (SlotOffer slotOffer : slots) { final AllocatedSlot slot = new AllocatedSlot( slotOffer.getAllocationId(), jid, taskManagerLocation, slotOffer.getSlotIndex(), slotOffer.getResourceProfile(), rpcTaskManagerGateway); slotsAndOffers.add(new Tuple2<>(slot, slotOffer)); } return slotPoolGateway.offerSlots(slotsAndOffers); }
final RpcTaskManagerGateway rpcTaskManagerGateway = new RpcTaskManagerGateway(taskExecutorGateway, this.getFencingToken());