}
@Override
public void run() {
try {
ContainerLauncher containerLauncher =
new ContainerLauncher(getConfig(), fs, container);
containerLauncher.setupUGI();
containerLauncher.putEnv(envVars);
log.debug("Launching container {} into role {}",
container.getId(),
containerRole);
//now build up the configuration data
Path containerTmpDirPath =
new Path(launcherTmpDirPath, container.getId().toString());
provider.buildContainerLaunchContext(containerLauncher,
instanceDefinition,
container,
containerRole,
fs,
generatedConfDirPath,
resourceComponent,
appComponent,
containerTmpDirPath);
RoleInstance instance = new RoleInstance(container);
String[] envDescription = containerLauncher.dumpEnvToString();
String commandsAsString = containerLauncher.getCommandsAsString();
log.info("Starting container with command: {}",
commandsAsString);
instance.command = commandsAsString;
instance.role = containerRole;
instance.roleId = role.id;
instance.environment = envDescription;
containerStarter.startContainer(container,
containerLauncher.completeContainerLaunch(),
instance);
} catch (Exception e) {
log.error("Exception thrown while trying to start {}: {}",
containerRole, e);
raisedException = e;