private static boolean continueRunning(ThreadPerStageScheduler tpss, final PronghornStage stage) { return ( (!GraphManager.isStageShuttingDown(tpss.graphManager, stage.stageId))) && (!tpss.isShuttingDown || GraphManager.mayHaveUpstreamData(tpss.graphManager, stage.stageId) ); }
public static void blockUntilStageTerminated(GraphManager gm, PronghornStage stageToWatch) { //keep waiting until this stage starts it shut down or completed its shutdown, //eg return on leading edge as soon as we detect shutdown in progress.. while (! (isStageShuttingDown(gm, stageToWatch.stageId)||isStageTerminated(gm, stageToWatch.stageId)) ) { try { Thread.sleep(1); } catch (InterruptedException e) { throw new RuntimeException(e); } } }
public void requestShutdown() { if (!GraphManager.isStageShuttingDown(graphManager, stageId)) { GraphManager.setStateToStopping(graphManager, stageId); } }
public static boolean blockUntilStageTerminated(GraphManager gm, PronghornStage stageToWatch, long timeoutMS) { //keep waiting until this stage starts it shut down or completed its shutdown, //eg return on leading edge as soon as we detect shutdown in progress.. while (--timeoutMS>=0 && (! (isStageShuttingDown(gm, stageToWatch.stageId)||isStageTerminated(gm, stageToWatch.stageId))) ) { try { Thread.sleep(1); } catch (InterruptedException e) { Thread.currentThread().interrupt(); return true; } } return timeoutMS>=0; }
public static boolean isStageShuttingDown(final GraphManager m, final int stageId) { return isStageShuttingDown(stageStateArray(m), stageId); }
private void run(GraphManager gm, PronghornStage watch) { NonThreadScheduler scheduler = new NonThreadScheduler(gm); scheduler.startup(); long limit = System.currentTimeMillis() + TIMEOUT; while (!GraphManager.isStageShuttingDown(gm, watch.stageId)) { scheduler.run(); scheduler.checkForException();//will throw for unexpected exceptions discovered in the graph. if (System.currentTimeMillis()>limit) { scheduler.shutdown(); Assert.fail("Timeout"); } } scheduler.shutdown(); }
return 0==inputCounts && !isStageShuttingDown(m, stageId); //if input is shutting down it must not re-schedule
private static void run(GraphManager graphManager, PronghornStage stage, NonThreadScheduler that) { try { if (!GraphManager.isStageShuttingDown(graphManager, stage.stageId)) {