/** * Helper method to build a tree of all exertion IDs in a tree - required by setFlow * * @param sortedSubXrt * @return */ private List<String> addSubExertions(List<Mogram> sortedSubXrt) { List<String> sortedSubsetIds = new ArrayList<String>(); for (Mogram xrt : sortedSubXrt) { sortedSubsetIds.add(xrt.getId().toString()); if (xrt instanceof Job) sortedSubsetIds.addAll(addSubExertions(((Job) xrt).getMograms())); } return sortedSubsetIds; }
/** * Determine the Flow (PAR or SEQ) for exertions that have the Flow set to AUTO * * @param topXrt * @param sortedSubXrt * @return */ private Strategy.Flow setFlow(Exertion topXrt, List<Mogram> sortedSubXrt) { List<String> sortedSubsetIds = addSubExertions(sortedSubXrt); int edges = 0; for (Mogram xrt : topXrt.getMograms()) { for (String depId : dag.getParentLabels(xrt.getId().toString())) { if (sortedSubsetIds.contains(depId)) { edges++; logger.debug("Edge: " + xrt.getName() + " parent: " + depId); } } for (String depId : dag.getChildLabels(xrt.getId().toString())) { if (sortedSubsetIds.contains(depId)) { edges++; logger.debug("Edge: " + xrt.getName() + " child: " + depId); } } } if (topXrt.getMograms().size() > 0) logger.debug("XRT " + topXrt.getName() + " has edges: " + edges); if (edges == 0) return Strategy.Flow.PAR; else return Strategy.Flow.SEQ; }