}
private ProgramOptions createFlowletOptions(String name, int instanceId, int instances, RunId runId) {
// Get the right user arguments.
Arguments userArguments = new BasicArguments();
if (programOptions.containsKey(runId)) {
userArguments = programOptions.get(runId).getUserArguments();
}
return new SimpleProgramOptions(name, new BasicArguments(
ImmutableMap.of(
ProgramOptionConstants.INSTANCE_ID, Integer.toString(instanceId),
ProgramOptionConstants.INSTANCES, Integer.toString(instances),
ProgramOptionConstants.RUN_ID, runId.getId()
)), userArguments