use of org.apache.slider.common.params.ActionDestroyArgs in project hive by apache.
the class LlapSliderUtils method startCluster.
public static void startCluster(Configuration conf, String name, String packageName, Path packageDir, String queue) {
LOG.info("Starting cluster with " + name + ", " + packageName + ", " + queue + ", " + packageDir);
SliderClient sc;
try {
sc = createSliderClient(conf);
} catch (Exception e) {
throw new RuntimeException(e);
}
try {
LOG.info("Executing the freeze command");
ActionFreezeArgs freezeArgs = new ActionFreezeArgs();
freezeArgs.force = true;
// Wait forever (or at least for an hour).
freezeArgs.setWaittime(3600);
try {
sc.actionFreeze(name, freezeArgs);
} catch (UnknownApplicationInstanceException ex) {
LOG.info("There was no old application instance to freeze");
}
LOG.info("Executing the destroy command");
ActionDestroyArgs destroyArg = new ActionDestroyArgs();
destroyArg.force = true;
try {
sc.actionDestroy(name, destroyArg);
} catch (UnknownApplicationInstanceException ex) {
LOG.info("There was no old application instance to destroy");
}
LOG.info("Executing the install command");
ActionInstallPackageArgs installArgs = new ActionInstallPackageArgs();
installArgs.name = "LLAP";
installArgs.packageURI = new Path(packageDir, packageName).toString();
installArgs.replacePkg = true;
sc.actionInstallPkg(installArgs);
LOG.info("Executing the create command");
ActionCreateArgs createArgs = new ActionCreateArgs();
createArgs.resources = new File(new Path(packageDir, "resources.json").toString());
createArgs.template = new File(new Path(packageDir, "appConfig.json").toString());
createArgs.setWaittime(3600);
if (queue != null) {
createArgs.queue = queue;
}
// See the comments in the method. SliderClient doesn't work in normal circumstances.
File bogusSliderFile = startSetSliderLibDir();
try {
sc.actionCreate(name, createArgs);
} finally {
endSetSliderLibDir(bogusSliderFile);
}
LOG.debug("Started the cluster via slider API");
} catch (YarnException | IOException e) {
throw new RuntimeException(e);
} finally {
try {
sc.close();
} catch (IOException e) {
LOG.info("Failed to close slider client", e);
}
}
}
Aggregations