public StageRunner getRunnerForStage(String stageName) { for(StageRunner runner : runnerMap.values()) { if(runner.getStageGroup().hasStage(stageName)) { return runner; } } return null; }
public void run() { started = true; if (!prepared) { logger.error("The StageRunner was not prepared prior to being started. Aborting!"); return; } if (stageGroup.isEmpty()) { logger.info("Stage group " + stageGroup.getName() + " has no stages, and can not be started."); return; } do { logger.info("Starting stage group " + stageGroup.getName() + ". Times started so far: " + timesStarted); timesStarted++; boolean cleanShutdown = runGroup(); if (cleanShutdown) { return; } if (!hasQueried()) { logger.error("The stage group " + stageGroup.getName() + " did not start. It will not be restarted until configuration changes."); return; } } while ((timesToRetry == -1 || timesToRetry >= timesStarted) && !shutdownHandler.isShuttingDown()); logger.error("Stage group " + stageGroup.getName() + " has failed and cannot be restarted. "); }
public void findAndDestroy(String groupName) { StageRunner sw = removeRunner(groupName); if(sw!=null) { sw.destroy(); } }
/** * Destroys the JVM running this stage and removes it's working files. * Should a JVM shutdown fail, it will throw an IllegalStateException. */ public void destroy() { logger.debug("Attempting to destroy JVM running stage group " + stageGroup.getName()); boolean success = stageDestroyer.killAll(); if (success) { logger.debug("... destruction successful"); } else { logger.error("JVM running stage group " + stageGroup.getName() + " was not killed"); throw new IllegalStateException("Orphaned process for " + stageGroup.getName()); } removeFiles(); wasKilled = true; }
private void addMissingGroups(Pipeline newPipeline) { for(StageGroup group : newPipeline.getStageGroups()) { if(!pipeline.hasGroup(group.getName())) { pipeline.addGroup(group); if(attachFiles(group)) { sm.addRunner(new StageRunner(group, new File(namespace), port, conf.isPerformanceLogging(), conf.getLoggingPort(), shutdownHandler)); } else { logger.error("Was unable to start the stage group '"+group.getName()+"' due to missing libraries."); } } } }
map.put("classpath", getClassPath());
public void addRunner(StageRunner runner) { runnerMap.put(runner.getStageGroup().getName(), runner); }