program = Programs.create(locationFactory.create(programLocation), classLoader);
// See if it is launched from Workflow, if it is, change the Program.
if (workflowBatch != null) {
MapReduceSpecification mapReduceSpec = program.getSpecification().getMapReduce().get(workflowBatch);
Preconditions.checkArgument(mapReduceSpec != null, "Cannot find MapReduceSpecification for %s", workflowBatch);
program = new WorkflowMapReduceProgram(program, mapReduceSpec);
}
} catch (IOException e) {
LOG.error("Could not init Program based on location: " + programLocation);
throw Throwables.propagate(e);
}