@Override public void onError(Throwable error) { if (yarnFrameworkMaster != null) { yarnFrameworkMaster.tell( new FatalErrorOccurred("Connection to YARN Resource Manager failed", error), ActorRef.noSender()); } } }
/** * Blocks until all TaskManagers are connected to the JobManager. */ @Override public void waitForClusterToBeReady() { logAndSysout("Waiting until all TaskManagers have connected"); for (GetClusterStatusResponse currentStatus, lastStatus = null; true; lastStatus = currentStatus) { currentStatus = getClusterStatus(); if (currentStatus != null && !currentStatus.equals(lastStatus)) { logAndSysout("TaskManager status (" + currentStatus.numRegisteredTaskManagers() + "/" + numberTaskManagers + ")"); if (currentStatus.numRegisteredTaskManagers() >= numberTaskManagers) { logAndSysout("All TaskManagers are connected"); break; } } else if (lastStatus == null) { logAndSysout("No status updates from the YARN cluster received so far. Waiting ..."); } try { Thread.sleep(250); } catch (InterruptedException e) { throw new RuntimeException("Interrupted while waiting for TaskManagers", e); } } }
@Override public GetClusterStatusResponse getClusterStatus() { ActorGateway jmGateway; try { jmGateway = getJobManagerGateway(); Future<Object> future = jmGateway.ask(GetClusterStatus.getInstance(), timeout); Object result = Await.result(future, timeout); if (result instanceof GetClusterStatusResponse) { return (GetClusterStatusResponse) result; } else { throw new RuntimeException("Received the wrong reply " + result + " from cluster."); } } catch (Exception e) { throw new RuntimeException("Couldn't retrieve the cluster status.", e); } }
self().tell(decorateMessage(new StopCluster(ApplicationStatus.FAILED, msg)), ActorRef.noSender());
private void stopAfterJob(JobID jobID) { Preconditions.checkNotNull(jobID, "The job id must not be null"); try { Future<Object> replyFuture = getJobManagerGateway().ask( new ShutdownClusterAfterJob(jobID), akkaDuration); Await.ready(replyFuture, akkaDuration); } catch (Exception e) { throw new RuntimeException("Unable to tell application master to stop once the specified job has been finised", e); } }
@Override public void run() { InfoMessage infoMessage = new InfoMessage(message); for (InfoMessageListenerRpcGateway listenerRpcGateway : infoMessageListeners.values()) { listenerRpcGateway .notifyInfoMessage(infoMessage); } } });
/** * This method causes the resource framework master to <b>asynchronously</b>re-examine * the set of available and pending workers containers, and release or allocate * containers if needed. The method sends an actor message which will trigger the * re-examination. */ public void triggerCheckWorkers() { self().tell( decorateMessage( CheckAndAllocateContainers.get()), ActorRef.noSender()); }
@Override public void notifyLeaderAddress(String leaderAddress, UUID leaderSessionID) { self().tell( new NewLeaderAvailable(leaderAddress, leaderSessionID), ActorRef.noSender()); }
(resourceManagerGateway, leaderGateway) -> { resourceManagerGateway.tell( new NotifyResourceStarted(YarnFlinkResourceManager.extractResourceID(container)), leaderGateway); return null; resourceManagerGateway.tell(new RegisterResourceManagerSuccessful(leader1, Collections.emptyList())); resourceManagerGateway.tell(new RegisterResourceManagerSuccessful(leader1, Collections.emptyList())); new NotifyResourceStarted(YarnFlinkResourceManager.extractResourceID(container)), leader1Gateway);
@Override public void stopCluster(final ApplicationStatus applicationStatus, final String message) { actorGateway.tell(new StopCluster(applicationStatus, message)); }
@Override public void onError(Throwable error) { if (yarnFrameworkMaster != null) { yarnFrameworkMaster.tell( new FatalErrorOccurred("Connection to YARN Resource Manager failed", error), ActorRef.noSender()); } } }
/** * This method is only available if the cluster hasn't been started in detached mode. */ @Override public GetClusterStatusResponse getClusterStatus() { try { final Future<Object> clusterStatusOption = getJobManagerGateway().ask( GetClusterStatus.getInstance(), akkaDuration); return (GetClusterStatusResponse) Await.result(clusterStatusOption, akkaDuration); } catch (Exception e) { throw new RuntimeException("Unable to get ClusterClient status from Application Client", e); } }
private void stopAfterJob(ClusterClient client, JobID jobID) { Preconditions.checkNotNull(jobID, "The job id must not be null"); try { Future<Object> replyFuture = client.getJobManagerGateway().ask( new ShutdownClusterAfterJob(jobID), AKKA_TIMEOUT); Await.ready(replyFuture, AKKA_TIMEOUT); } catch (Exception e) { throw new RuntimeException("Unable to tell application master to stop" + " once the specified job has been finished", e); } } }
protected void sendInfoMessage(String message) { for (ActorRef listener : infoMessageListeners) { listener.tell(decorateMessage(new InfoMessage(message)), self()); } }
/** * This method causes the resource framework master to <b>asynchronously</b>re-examine * the set of available and pending workers containers, and release or allocate * containers if needed. The method sends an actor message which will trigger the * re-examination. */ public void triggerCheckWorkers() { self().tell( decorateMessage( CheckAndAllocateContainers.get()), ActorRef.noSender()); }
@Override public void stopCluster(final ApplicationStatus applicationStatus, final String message) { actorGateway.tell(new StopCluster(applicationStatus, message)); }
@Override public void onError(Throwable error) { if (yarnFrameworkMaster != null) { yarnFrameworkMaster.tell( new FatalErrorOccurred("Connection to YARN Resource Manager failed", error), ActorRef.noSender()); } } }
@Override public void stopCluster(final ApplicationStatus applicationStatus, final String message) { actorGateway.tell(new StopCluster(applicationStatus, message)); }
@Override public void stopCluster(final ApplicationStatus applicationStatus, final String message) { actorGateway.tell(new StopCluster(applicationStatus, message)); }