ProgramType processorType = program.getType();
Preconditions.checkNotNull(processorType, "Missing processor type.");
Preconditions.checkArgument(processorType == ProgramType.WORKFLOW, "Only WORKFLOW process type is supported.");
WorkflowSpecification workflowSpec = appSpec.getWorkflows().get(program.getName());
Preconditions.checkNotNull(workflowSpec, "Missing WorkflowSpecification for %s", program.getName());
LOG.info("Launching distributed workflow: " + program.getName() + ":" + workflowSpec.getName());
TwillController controller = launcher.launch(new WorkflowTwillApplication(program, workflowSpec,
hConfFile, cConfFile, eventHandler));
return new WorkflowTwillProgramController(program.getName(), controller).startListen();
}