BatchScheduler(String batchId, BatchScript batchScript, ExecutionLock lock, ExecutorService executor) { assert batchId != null; assert batchScript != null; assert lock != null; assert executor != null; this.batchId = batchId; this.flows = new LinkedList<>(batchScript.getAllFlows()); this.lock = lock; this.executor = executor; this.running = new HashMap<>(); this.blocking = new HashSet<>(); for (FlowScript flow : flows) { blocking.add(flow.getId()); } this.doneQueue = new LinkedBlockingQueue<>(); }
private static JsonObject analyzeBatch(BatchScript script) { assert script != null; JsonArray jobflows = new JsonArray(); for (FlowScript flowScript : script.getAllFlows()) { JsonObject jobflow = analyzeJobflow(flowScript); jobflows.add(jobflow); } JsonObject batch = new JsonObject(); batch.addProperty("id", script.getId()); batch.add("jobflows", jobflows); return batch; }