@Test public void testFlattenWorkUnits() { List<WorkUnit> workUnitsOnly = Arrays.asList(WorkUnit.createEmpty(), WorkUnit.createEmpty(), WorkUnit.createEmpty()); Assert.assertEquals(JobLauncherUtils.flattenWorkUnits(workUnitsOnly).size(), 3); MultiWorkUnit multiWorkUnit1 = MultiWorkUnit.createEmpty(); multiWorkUnit1.addWorkUnits(Arrays.asList(WorkUnit.createEmpty(), WorkUnit.createEmpty(), WorkUnit.createEmpty())); MultiWorkUnit multiWorkUnit2 = MultiWorkUnit.createEmpty(); multiWorkUnit1.addWorkUnits(Arrays.asList(WorkUnit.createEmpty(), WorkUnit.createEmpty(), WorkUnit.createEmpty())); List<WorkUnit> workUnitsAndMultiWorkUnits = Arrays.asList(WorkUnit.createEmpty(), WorkUnit.createEmpty(), WorkUnit.createEmpty(), multiWorkUnit1, multiWorkUnit2); Assert.assertEquals(JobLauncherUtils.flattenWorkUnits(workUnitsAndMultiWorkUnits).size(), 9); }
public static List<WorkUnit> flattenWorkUnits(Collection<WorkUnit> workUnits) { List<WorkUnit> flattenedWorkUnits = Lists.newArrayList(); for (WorkUnit workUnit : workUnits) { if (workUnit instanceof MultiWorkUnit) { flattenedWorkUnits.addAll(flattenWorkUnits(((MultiWorkUnit) workUnit).getWorkUnits())); } else { flattenedWorkUnits.add(workUnit); } } return flattenedWorkUnits; }
JobLauncherUtils { public static List<WorkUnit> flattenWorkUnits(Collection<WorkUnit> workUnits) { List<WorkUnit> flattenedWorkUnits = Lists.newArrayList(); for (WorkUnit workUnit : workUnits) { if (workUnit instanceof MultiWorkUnit) { flattenedWorkUnits.addAll(flattenWorkUnits(((MultiWorkUnit) workUnit).getWorkUnits())); } else { flattenedWorkUnits.add(workUnit); } } return flattenedWorkUnits; } }
JobLauncherUtils { public static List<WorkUnit> flattenWorkUnits(Collection<WorkUnit> workUnits) { List<WorkUnit> flattenedWorkUnits = Lists.newArrayList(); for (WorkUnit workUnit : workUnits) { if (workUnit instanceof MultiWorkUnit) { flattenedWorkUnits.addAll(flattenWorkUnits(((MultiWorkUnit) workUnit).getWorkUnits())); } else { flattenedWorkUnits.add(workUnit); } } return flattenedWorkUnits; }  }
JobLauncherUtils { public static List<WorkUnit> flattenWorkUnits(Collection<WorkUnit> workUnits) { List<WorkUnit> flattenedWorkUnits = Lists.newArrayList(); for (WorkUnit workUnit : workUnits) { if (workUnit instanceof MultiWorkUnit) { flattenedWorkUnits.addAll(flattenWorkUnits(((MultiWorkUnit) workUnit).getWorkUnits())); } else { flattenedWorkUnits.add(workUnit); } } return flattenedWorkUnits; }  static String newJobId(String jobName); static String newTaskId(String jobId, int sequence); static String newMultiTaskId(String jobId, int sequence); static List<WorkUnit> flattenWorkUnits(Collection<WorkUnit> workUnits); static void cleanStagingData(List<? extends State> states, Logger logger); static void cleanJobStagingData(State state, Logger logger); static void cleanTaskStagingData(State state, Logger logger); static void cleanTaskStagingData(State state, Logger logger, Closer closer,
      Map<String, ParallelRunner> parallelRunners); static void cleanUpOldJobData(State state, Logger logger, boolean stagingDirProvided, boolean outputDirProvided); }
JobLauncherUtils { public static List<WorkUnit> flattenWorkUnits(Collection<WorkUnit> workUnits) { List<WorkUnit> flattenedWorkUnits = Lists.newArrayList(); for (WorkUnit workUnit : workUnits) { if (workUnit instanceof MultiWorkUnit) { flattenedWorkUnits.addAll(flattenWorkUnits(((MultiWorkUnit) workUnit).getWorkUnits())); } else { flattenedWorkUnits.add(workUnit); } } return flattenedWorkUnits; }  static String newJobId(String jobName); static String newTaskId(String jobId, int sequence); static String newMultiTaskId(String jobId, int sequence); static List<WorkUnit> flattenWorkUnits(Collection<WorkUnit> workUnits); static void cleanStagingData(List<? extends State> states, Logger logger); static void cleanJobStagingData(State state, Logger logger); static void cleanTaskStagingData(State state, Logger logger); static void cleanTaskStagingData(State state, Logger logger, Closer closer,
      Map<String, ParallelRunner> parallelRunners); static void cleanUpOldJobData(State state, Logger logger, boolean stagingDirProvided, boolean outputDirProvided);  }