Search in sources :

Example 1 with UnknownApplicationInstanceException

use of org.apache.slider.core.exceptions.UnknownApplicationInstanceException 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);
        }
    }
}
Also used : Path(org.apache.hadoop.fs.Path) UnknownApplicationInstanceException(org.apache.slider.core.exceptions.UnknownApplicationInstanceException) ActionDestroyArgs(org.apache.slider.common.params.ActionDestroyArgs) IOException(java.io.IOException) IOException(java.io.IOException) YarnException(org.apache.hadoop.yarn.exceptions.YarnException) UnknownApplicationInstanceException(org.apache.slider.core.exceptions.UnknownApplicationInstanceException) ActionFreezeArgs(org.apache.slider.common.params.ActionFreezeArgs) YarnException(org.apache.hadoop.yarn.exceptions.YarnException) SliderClient(org.apache.slider.client.SliderClient) ActionInstallPackageArgs(org.apache.slider.common.params.ActionInstallPackageArgs) File(java.io.File) ActionCreateArgs(org.apache.slider.common.params.ActionCreateArgs)

Aggregations

File (java.io.File)1 IOException (java.io.IOException)1 Path (org.apache.hadoop.fs.Path)1 YarnException (org.apache.hadoop.yarn.exceptions.YarnException)1 SliderClient (org.apache.slider.client.SliderClient)1 ActionCreateArgs (org.apache.slider.common.params.ActionCreateArgs)1 ActionDestroyArgs (org.apache.slider.common.params.ActionDestroyArgs)1 ActionFreezeArgs (org.apache.slider.common.params.ActionFreezeArgs)1 ActionInstallPackageArgs (org.apache.slider.common.params.ActionInstallPackageArgs)1 UnknownApplicationInstanceException (org.apache.slider.core.exceptions.UnknownApplicationInstanceException)1