Search in sources :

Example 6 with CommandObject

use of org.apache.airavata.model.appcatalog.appdeployment.CommandObject in project airavata by apache.

the class RegisterSampleApplications method registerBigRedApps.

public void registerBigRedApps() {
    try {
        System.out.println("#### Registering Application Deployments on BigRed II #### \n");
        // Register Echo
        String echoAppDeployId = airavataClient.registerApplicationDeployment(new AuthzToken(""), DEFAULT_GATEWAY, RegisterSampleApplicationsUtils.createApplicationDeployment(echoModuleId, bigredResourceId, "/N/u/cgateway/BigRed2/production/app_wrappers/echo_wrapper.sh", ApplicationParallelismType.SERIAL, echoDescription, null, null, null));
        System.out.println("Echo on bigredII deployment Id " + echoAppDeployId);
        // Register Amber
        List<CommandObject> amberModuleLoadCMDsBr2 = new ArrayList();
        amberModuleLoadCMDsBr2.add(new CommandObject("module load amber/gnu/mpi/12"));
        amberModuleLoadCMDsBr2.add(new CommandObject("module swap PrgEnv-cray PrgEnv-gnu"));
        String amberAppDeployId = airavataClient.registerApplicationDeployment(new AuthzToken(""), DEFAULT_GATEWAY, RegisterSampleApplicationsUtils.createApplicationDeployment(amberModuleId, bigredResourceId, "/N/soft/cle4/amber/gnu/mpi/12/amber12/bin/sander.MPI -O", ApplicationParallelismType.MPI, amberDescription, amberModuleLoadCMDsBr2, null, null));
        System.out.println("Amber on bigredII deployment Id " + amberAppDeployId);
        // Register AutoDock
        String autoDockDeployId = airavataClient.registerApplicationDeployment(new AuthzToken(""), DEFAULT_GATEWAY, RegisterSampleApplicationsUtils.createApplicationDeployment(autoDockModuleId, bigredResourceId, "/N/u/cgateway/BigRed2/production/app_wrappers/auto_dock_wrapper.sh", ApplicationParallelismType.MPI, autoDockDescription, null, null, null));
        System.out.println("AutoDock on bigredII deployment Id " + autoDockDeployId);
    // //Register GROMACS
    // String gromacsAppDeployId = airavataClient.registerApplicationDeployment(
    // RegisterSampleApplicationsUtils.createApplicationDeployment(gromacsModuleId, bigredResourceId,
    // "/N/u/cgateway/BigRed2/production/app_wrappers/gromacs_wrapper.sh", ApplicationParallelismType.MPI,
    // gromacsDescription));
    // System.out.println("GROMACS on bigredII deployment Id " + gromacsAppDeployId);
    // 
    // //Register LAMMPS
    // String lammpsAppDeployId = airavataClient.registerApplicationDeployment(
    // RegisterSampleApplicationsUtils.createApplicationDeployment(lammpsModuleId, bigredResourceId,
    // "/N/u/cgateway/BigRed2/production/app_wrappers/lammps_wrapper.sh", ApplicationParallelismType.MPI,
    // lammpsDescription));
    // System.out.println("LAMMPS on bigredII deployment Id " + lammpsAppDeployId);
    } catch (TException e) {
        e.printStackTrace();
    }
}
Also used : CommandObject(org.apache.airavata.model.appcatalog.appdeployment.CommandObject) TException(org.apache.thrift.TException) AuthzToken(org.apache.airavata.model.security.AuthzToken)

Example 7 with CommandObject

use of org.apache.airavata.model.appcatalog.appdeployment.CommandObject in project airavata by apache.

the class ApplicationDeploymentImpl method updateApplicationDeployment.

@Override
public void updateApplicationDeployment(String deploymentId, ApplicationDeploymentDescription updatedDeployment) throws AppCatalogException {
    try {
        AppDeploymentResource deploymentResource = new AppDeploymentResource();
        AppDeploymentResource existingDep = (AppDeploymentResource) deploymentResource.get(deploymentId);
        ComputeResourceResource computeHostResource = new ComputeResourceResource();
        AppModuleResource moduleResource = new AppModuleResource();
        if (!computeHostResource.isExists(updatedDeployment.getComputeHostId())) {
            logger.error("Compute host does not exist in the system. Please create a Compute host first...");
            throw new AppCatalogException("Compute host does not exist in the system. Please create a Compute host first...");
        }
        if (!moduleResource.isExists(updatedDeployment.getAppModuleId())) {
            logger.error("Application module does not exist in the system. Please create an application module first...");
            throw new AppCatalogException("Application module does not exist in the system. Please create an application module first...");
        }
        AppModuleResource module = (AppModuleResource) moduleResource.get(updatedDeployment.getAppModuleId());
        existingDep.setAppModuleId(updatedDeployment.getAppModuleId());
        existingDep.setModuleResource(module);
        existingDep.setHostId(updatedDeployment.getComputeHostId());
        existingDep.setHostResource((ComputeResourceResource) computeHostResource.get(updatedDeployment.getComputeHostId()));
        existingDep.setAppDes(updatedDeployment.getAppDeploymentDescription());
        existingDep.setExecutablePath(updatedDeployment.getExecutablePath());
        existingDep.setDefaultQueueName(updatedDeployment.getDefaultQueueName());
        existingDep.setDefaultCPUCount(updatedDeployment.getDefaultCPUCount());
        existingDep.setDefaultNodeCount(updatedDeployment.getDefaultNodeCount());
        existingDep.setDefaultWalltime(updatedDeployment.getDefaultWalltime());
        existingDep.setEditableByUser(updatedDeployment.isEditableByUser());
        if (updatedDeployment.getParallelism() != null) {
            existingDep.setParallelism(updatedDeployment.getParallelism().toString());
        }
        existingDep.save();
        // remove existing module load commands
        ModuleLoadCmdResource cmdResource = new ModuleLoadCmdResource();
        Map<String, String> ids = new HashMap<String, String>();
        ids.put(AppCatAbstractResource.ModuleLoadCmdConstants.APP_DEPLOYMENT_ID, deploymentId);
        cmdResource.remove(ids);
        List<CommandObject> moduleLoadCmds = updatedDeployment.getModuleLoadCmds();
        if (moduleLoadCmds != null && !moduleLoadCmds.isEmpty()) {
            for (CommandObject cmd : moduleLoadCmds) {
                ids = new HashMap<String, String>();
                ids.put(AppCatAbstractResource.ModuleLoadCmdConstants.APP_DEPLOYMENT_ID, deploymentId);
                ids.put(AppCatAbstractResource.ModuleLoadCmdConstants.CMD, cmd.getCommand());
                if (cmdResource.isExists(ids)) {
                    cmdResource = (ModuleLoadCmdResource) cmdResource.get(ids);
                }
                cmdResource.setCmd(cmd.getCommand());
                cmdResource.setAppDeploymentResource(existingDep);
                cmdResource.setAppDeploymentId(deploymentId);
                cmdResource.setOrder(cmd.getCommandOrder());
                cmdResource.save();
            }
        }
        PreJobCommandResource preJobCommandResource = new PreJobCommandResource();
        ids = new HashMap<String, String>();
        ids.put(AppCatAbstractResource.PreJobCommandConstants.DEPLOYMENT_ID, deploymentId);
        preJobCommandResource.remove(ids);
        List<CommandObject> preJobCommands = updatedDeployment.getPreJobCommands();
        if (preJobCommands != null && !preJobCommands.isEmpty()) {
            for (CommandObject cmd : preJobCommands) {
                ids = new HashMap<String, String>();
                ids.put(AppCatAbstractResource.PreJobCommandConstants.DEPLOYMENT_ID, deploymentId);
                ids.put(AppCatAbstractResource.PreJobCommandConstants.COMMAND, cmd.getCommand());
                if (preJobCommandResource.isExists(ids)) {
                    preJobCommandResource = (PreJobCommandResource) preJobCommandResource.get(ids);
                }
                preJobCommandResource.setCommand(cmd.getCommand());
                preJobCommandResource.setAppDeploymentResource(existingDep);
                preJobCommandResource.setAppDeploymentId(deploymentId);
                preJobCommandResource.setOrder(cmd.getCommandOrder());
                preJobCommandResource.save();
            }
        }
        PostJobCommandResource postJobCommandResource = new PostJobCommandResource();
        ids = new HashMap<String, String>();
        ids.put(AppCatAbstractResource.PostJobCommandConstants.DEPLOYMENT_ID, deploymentId);
        postJobCommandResource.remove(ids);
        List<CommandObject> postJobCommands = updatedDeployment.getPostJobCommands();
        if (postJobCommands != null && !postJobCommands.isEmpty()) {
            for (CommandObject cmd : postJobCommands) {
                ids = new HashMap<String, String>();
                ids.put(AppCatAbstractResource.PostJobCommandConstants.DEPLOYMENT_ID, deploymentId);
                ids.put(AppCatAbstractResource.PostJobCommandConstants.COMMAND, cmd.getCommand());
                if (postJobCommandResource.isExists(ids)) {
                    postJobCommandResource = (PostJobCommandResource) postJobCommandResource.get(ids);
                }
                postJobCommandResource.setCommand(cmd.getCommand());
                postJobCommandResource.setOrder(cmd.getCommandOrder());
                postJobCommandResource.setAppDeploymentResource(existingDep);
                postJobCommandResource.setAppDeploymentId(deploymentId);
                postJobCommandResource.save();
            }
        }
        // remove existing lib prepand paths
        LibraryPrepandPathResource prepandPathResource = new LibraryPrepandPathResource();
        ids = new HashMap<String, String>();
        ids.put(AppCatAbstractResource.LibraryPrepandPathConstants.DEPLOYMENT_ID, deploymentId);
        prepandPathResource.remove(ids);
        List<SetEnvPaths> libPrependPaths = updatedDeployment.getLibPrependPaths();
        if (libPrependPaths != null && !libPrependPaths.isEmpty()) {
            for (SetEnvPaths path : libPrependPaths) {
                ids = new HashMap<String, String>();
                ids.put(AppCatAbstractResource.LibraryPrepandPathConstants.DEPLOYMENT_ID, deploymentId);
                ids.put(AppCatAbstractResource.LibraryPrepandPathConstants.NAME, path.getName());
                if (prepandPathResource.isExists(ids)) {
                    prepandPathResource = (LibraryPrepandPathResource) prepandPathResource.get(ids);
                }
                prepandPathResource.setAppDeploymentResource(existingDep);
                prepandPathResource.setName(path.getName());
                prepandPathResource.setValue(path.getValue());
                prepandPathResource.setDeploymentId(deploymentId);
                prepandPathResource.save();
            }
        }
        List<SetEnvPaths> libApendPaths = updatedDeployment.getLibAppendPaths();
        // remove lib append paths
        LibraryApendPathResource apendPathResource = new LibraryApendPathResource();
        ids = new HashMap<String, String>();
        ids.put(AppCatAbstractResource.LibraryApendPathConstants.DEPLOYMENT_ID, deploymentId);
        apendPathResource.remove(ids);
        if (libApendPaths != null && !libApendPaths.isEmpty()) {
            for (SetEnvPaths path : libApendPaths) {
                ids = new HashMap<String, String>();
                ids.put(AppCatAbstractResource.LibraryApendPathConstants.DEPLOYMENT_ID, deploymentId);
                ids.put(AppCatAbstractResource.LibraryApendPathConstants.NAME, path.getName());
                if (apendPathResource.isExists(ids)) {
                    apendPathResource = (LibraryApendPathResource) apendPathResource.get(ids);
                }
                apendPathResource.setAppDeploymentResource(existingDep);
                apendPathResource.setName(path.getName());
                apendPathResource.setValue(path.getValue());
                apendPathResource.setDeploymentId(deploymentId);
                apendPathResource.save();
            }
        }
        List<SetEnvPaths> setEnvironment = updatedDeployment.getSetEnvironment();
        // remove existing setEnvPaths
        AppEnvironmentResource environmentResource = new AppEnvironmentResource();
        ids = new HashMap<String, String>();
        ids.put(AppCatAbstractResource.AppEnvironmentConstants.DEPLOYMENT_ID, deploymentId);
        environmentResource.remove(ids);
        if (setEnvironment != null && !setEnvironment.isEmpty()) {
            for (SetEnvPaths path : setEnvironment) {
                ids = new HashMap<String, String>();
                ids.put(AppCatAbstractResource.AppEnvironmentConstants.DEPLOYMENT_ID, deploymentId);
                ids.put(AppCatAbstractResource.AppEnvironmentConstants.NAME, path.getName());
                if (environmentResource.isExists(ids)) {
                    environmentResource = (AppEnvironmentResource) environmentResource.get(ids);
                }
                environmentResource.setAppDeploymentResource(existingDep);
                environmentResource.setName(path.getName());
                environmentResource.setValue(path.getValue());
                environmentResource.setDeploymentId(deploymentId);
                environmentResource.setOrder(path.getEnvPathOrder());
                environmentResource.save();
            }
        }
    } catch (Exception e) {
        logger.error("Error while updating application deployment...", e);
        throw new AppCatalogException(e);
    }
}
Also used : HashMap(java.util.HashMap) AppCatalogException(org.apache.airavata.registry.cpi.AppCatalogException) CommandObject(org.apache.airavata.model.appcatalog.appdeployment.CommandObject) AppCatalogException(org.apache.airavata.registry.cpi.AppCatalogException) SetEnvPaths(org.apache.airavata.model.appcatalog.appdeployment.SetEnvPaths)

Example 8 with CommandObject

use of org.apache.airavata.model.appcatalog.appdeployment.CommandObject in project airavata by apache.

the class ApplicationDeploymentImpl method addApplicationDeployment.

@Override
public String addApplicationDeployment(ApplicationDeploymentDescription deploymentDescription, String gatewayId) throws AppCatalogException {
    try {
        AppDeploymentResource deploymentResource = new AppDeploymentResource();
        ComputeResourceResource computeHostResource = new ComputeResourceResource();
        AppModuleResource moduleResource = new AppModuleResource();
        if (!computeHostResource.isExists(deploymentDescription.getComputeHostId())) {
            logger.error("Compute host does not exist in the system. Please create a Compute host first...");
            throw new AppCatalogException("Compute host does not exist in the system. Please create a Compute host first...");
        }
        if (!moduleResource.isExists(deploymentDescription.getAppModuleId())) {
            logger.error("Application module does not exist in the system. Please create an application module first...");
            throw new AppCatalogException("Application module does not exist in the system. Please create an application module first...");
        }
        AppModuleResource module = (AppModuleResource) moduleResource.get(deploymentDescription.getAppModuleId());
        ComputeResourceResource hostResource = (ComputeResourceResource) computeHostResource.get(deploymentDescription.getComputeHostId());
        deploymentResource.setDeploymentId(hostResource.getHostName() + "_" + deploymentDescription.getAppModuleId());
        deploymentResource.setAppModuleId(deploymentDescription.getAppModuleId());
        deploymentResource.setModuleResource(module);
        deploymentResource.setHostId(deploymentDescription.getComputeHostId());
        deploymentResource.setHostResource(hostResource);
        deploymentResource.setAppDes(deploymentDescription.getAppDeploymentDescription());
        deploymentResource.setExecutablePath(deploymentDescription.getExecutablePath());
        deploymentResource.setGatewayId(gatewayId);
        deploymentResource.setDefaultQueueName(deploymentDescription.getDefaultQueueName());
        deploymentResource.setDefaultCPUCount(deploymentDescription.getDefaultCPUCount());
        deploymentResource.setDefaultNodeCount(deploymentDescription.getDefaultNodeCount());
        deploymentResource.setDefaultWalltime(deploymentDescription.getDefaultWalltime());
        deploymentResource.setEditableByUser(deploymentDescription.isEditableByUser());
        ApplicationParallelismType parallelism = deploymentDescription.getParallelism();
        if (parallelism != null) {
            deploymentResource.setParallelism(parallelism.toString());
        }
        deploymentResource.save();
        deploymentDescription.setAppDeploymentId(deploymentResource.getDeploymentId());
        List<CommandObject> moduleLoadCmds = deploymentDescription.getModuleLoadCmds();
        if (moduleLoadCmds != null && !moduleLoadCmds.isEmpty()) {
            for (CommandObject cmd : moduleLoadCmds) {
                ModuleLoadCmdResource cmdResource = new ModuleLoadCmdResource();
                cmdResource.setAppDeploymentId(deploymentDescription.getAppDeploymentId());
                cmdResource.setOrder(cmd.getCommandOrder());
                cmdResource.setCmd(cmd.getCommand());
                cmdResource.save();
            }
        }
        List<CommandObject> preJobCommands = deploymentDescription.getPreJobCommands();
        if (preJobCommands != null && !preJobCommands.isEmpty()) {
            for (CommandObject cmd : preJobCommands) {
                PreJobCommandResource cmdResource = new PreJobCommandResource();
                cmdResource.setAppDeploymentId(deploymentDescription.getAppDeploymentId());
                cmdResource.setCommand(cmd.getCommand());
                cmdResource.setOrder(cmd.getCommandOrder());
                cmdResource.save();
            }
        }
        List<CommandObject> postJobCommands = deploymentDescription.getPostJobCommands();
        if (postJobCommands != null && !postJobCommands.isEmpty()) {
            for (CommandObject cmd : postJobCommands) {
                PostJobCommandResource cmdResource = new PostJobCommandResource();
                cmdResource.setAppDeploymentId(deploymentDescription.getAppDeploymentId());
                cmdResource.setCommand(cmd.getCommand());
                cmdResource.setOrder(cmd.getCommandOrder());
                cmdResource.save();
            }
        }
        List<SetEnvPaths> libPrependPaths = deploymentDescription.getLibPrependPaths();
        if (libPrependPaths != null && !libPrependPaths.isEmpty()) {
            for (SetEnvPaths path : libPrependPaths) {
                LibraryPrepandPathResource prepandPathResource = new LibraryPrepandPathResource();
                prepandPathResource.setAppDeploymentResource(deploymentResource);
                prepandPathResource.setName(path.getName());
                prepandPathResource.setValue(path.getValue());
                prepandPathResource.setDeploymentId(deploymentResource.getDeploymentId());
                prepandPathResource.save();
            }
        }
        List<SetEnvPaths> libApendPaths = deploymentDescription.getLibAppendPaths();
        if (libApendPaths != null && !libApendPaths.isEmpty()) {
            for (SetEnvPaths path : libApendPaths) {
                LibraryApendPathResource apendPathResource = new LibraryApendPathResource();
                apendPathResource.setAppDeploymentResource(deploymentResource);
                apendPathResource.setName(path.getName());
                apendPathResource.setValue(path.getValue());
                apendPathResource.setDeploymentId(deploymentResource.getDeploymentId());
                apendPathResource.save();
            }
        }
        List<SetEnvPaths> setEnvironment = deploymentDescription.getSetEnvironment();
        if (setEnvironment != null && !setEnvironment.isEmpty()) {
            for (SetEnvPaths path : setEnvironment) {
                AppEnvironmentResource environmentResource = new AppEnvironmentResource();
                environmentResource.setAppDeploymentResource(deploymentResource);
                environmentResource.setName(path.getName());
                environmentResource.setValue(path.getValue());
                environmentResource.setDeploymentId(deploymentResource.getDeploymentId());
                environmentResource.setOrder(path.getEnvPathOrder());
                environmentResource.save();
            }
        }
        return deploymentResource.getDeploymentId();
    } catch (Exception e) {
        logger.error("Error while saving application deployment...", e);
        throw new AppCatalogException(e);
    }
}
Also used : ApplicationParallelismType(org.apache.airavata.model.parallelism.ApplicationParallelismType) AppCatalogException(org.apache.airavata.registry.cpi.AppCatalogException) CommandObject(org.apache.airavata.model.appcatalog.appdeployment.CommandObject) AppCatalogException(org.apache.airavata.registry.cpi.AppCatalogException) SetEnvPaths(org.apache.airavata.model.appcatalog.appdeployment.SetEnvPaths)

Example 9 with CommandObject

use of org.apache.airavata.model.appcatalog.appdeployment.CommandObject in project airavata by apache.

the class AppDeploymentTest method testAppDeployment.

@Test
public void testAppDeployment() throws Exception {
    ApplicationDeployment appDep = appcatalog.getApplicationDeployment();
    ApplicationInterface appInt = appcatalog.getApplicationInterface();
    ComputeResource computeRs = appcatalog.getComputeResource();
    ComputeResourceDescription cm = new ComputeResourceDescription();
    cm.setHostName("localhost");
    cm.setResourceDescription("test compute host");
    String hostId = computeRs.addComputeResource(cm);
    ApplicationModule module = new ApplicationModule();
    module.setAppModuleName("WRF");
    module.setAppModuleVersion("1.0.0");
    String wrfModuleId = appInt.addApplicationModule(module, ServerSettings.getDefaultUserGateway());
    ApplicationDeploymentDescription description = new ApplicationDeploymentDescription();
    description.setAppModuleId(wrfModuleId);
    description.setComputeHostId(hostId);
    description.setExecutablePath("/home/a/b/c");
    description.setAppDeploymentDescription("test app deployment");
    CommandObject cmd1 = new CommandObject();
    cmd1.setCommand("cmd1");
    cmd1.setCommandOrder(1);
    CommandObject cmd2 = new CommandObject();
    cmd2.setCommand("cmd1");
    cmd2.setCommandOrder(1);
    description.addToModuleLoadCmds(cmd1);
    description.addToModuleLoadCmds(cmd2);
    List<SetEnvPaths> libPrepandPaths = new ArrayList<SetEnvPaths>();
    libPrepandPaths.add(createSetEnvPath("name1", "val1", 1));
    libPrepandPaths.add(createSetEnvPath("name2", "val2", 2));
    description.setLibPrependPaths(libPrepandPaths);
    List<SetEnvPaths> libApendPaths = new ArrayList<SetEnvPaths>();
    libApendPaths.add(createSetEnvPath("name3", "val3", 1));
    libApendPaths.add(createSetEnvPath("name4", "val4", 2));
    description.setLibAppendPaths(libApendPaths);
    List<SetEnvPaths> appEvns = new ArrayList<SetEnvPaths>();
    appEvns.add(createSetEnvPath("name5", "val5", 1));
    appEvns.add(createSetEnvPath("name6", "val6", 2));
    description.setSetEnvironment(appEvns);
    String appDepId = appDep.addApplicationDeployment(description, ServerSettings.getDefaultUserGateway());
    ApplicationDeploymentDescription app = null;
    if (appDep.isAppDeploymentExists(appDepId)) {
        app = appDep.getApplicationDeployement(appDepId);
        System.out.println("*********** application deployment id ********* : " + app.getAppDeploymentId());
        System.out.println("*********** application deployment desc ********* : " + app.getAppDeploymentDescription());
    }
    description.setAppDeploymentDescription("test app deployment2");
    appDep.updateApplicationDeployment(appDepId, description);
    if (appDep.isAppDeploymentExists(appDepId)) {
        app = appDep.getApplicationDeployement(appDepId);
        System.out.println("*********** application deployment desc ********* : " + app.getAppDeploymentDescription());
    }
    Map<String, String> moduleIdFilter = new HashMap<String, String>();
    moduleIdFilter.put(AppCatAbstractResource.ApplicationDeploymentConstants.APP_MODULE_ID, wrfModuleId);
    List<ApplicationDeploymentDescription> applicationDeployements = appDep.getApplicationDeployements(moduleIdFilter);
    System.out.println("******** Size of App deployments for module *********** : " + applicationDeployements.size());
    Map<String, String> hostFilter = new HashMap<String, String>();
    hostFilter.put(AppCatAbstractResource.ApplicationDeploymentConstants.COMPUTE_HOST_ID, hostId);
    List<ApplicationDeploymentDescription> applicationDeployementsForHost = appDep.getApplicationDeployements(hostFilter);
    System.out.println("******** Size of App deployments for host *********** : " + applicationDeployementsForHost.size());
    List<String> allApplicationDeployementIds = appDep.getAllApplicationDeployementIds();
    System.out.println("******** Size of all App deployments ids *********** : " + allApplicationDeployementIds.size());
    List<ApplicationDeploymentDescription> allApplicationDeployements = appDep.getAllApplicationDeployements(ServerSettings.getDefaultUserGateway());
    System.out.println("******** Size of all App deployments *********** : " + allApplicationDeployements.size());
    assertTrue("App interface saved successfully", app != null);
}
Also used : ApplicationDeploymentDescription(org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription) HashMap(java.util.HashMap) ComputeResourceDescription(org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescription) ArrayList(java.util.ArrayList) ApplicationModule(org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule) CommandObject(org.apache.airavata.model.appcatalog.appdeployment.CommandObject) SetEnvPaths(org.apache.airavata.model.appcatalog.appdeployment.SetEnvPaths) Test(org.junit.Test)

Example 10 with CommandObject

use of org.apache.airavata.model.appcatalog.appdeployment.CommandObject in project airavata by apache.

the class RegisterSampleApplications method registerStampedeApps.

public void registerStampedeApps() {
    try {
        System.out.println("#### Registering Application Deployments on Stampede #### \n");
        // Register Echo
        String echoAppDeployId = airavataClient.registerApplicationDeployment(new AuthzToken(""), DEFAULT_GATEWAY, RegisterSampleApplicationsUtils.createApplicationDeployment(echoModuleId, stampedeResourceId, "/home1/01437/ogce/production/app_wrappers/echo_wrapper.sh", ApplicationParallelismType.SERIAL, echoDescription, null, null, null));
        System.out.println("Echo on stampede deployment Id " + echoAppDeployId);
        // Register Amber
        List<CommandObject> moduleLoadCMDs = new ArrayList<>();
        CommandObject cmd = new CommandObject("module load amber");
        moduleLoadCMDs.add(cmd);
        ApplicationDeploymentDescription amberStampedeDeployment = RegisterSampleApplicationsUtils.createApplicationDeployment(amberModuleId, stampedeResourceId, "/opt/apps/intel13/mvapich2_1_9/amber/12.0/bin/sander.MPI -O", ApplicationParallelismType.MPI, amberDescription, moduleLoadCMDs, null, null);
        String amberAppDeployId = airavataClient.registerApplicationDeployment(new AuthzToken(""), DEFAULT_GATEWAY, amberStampedeDeployment);
        System.out.println("Amber on stampede deployment Id " + amberAppDeployId);
        // Register ESPRESSO
        String espressoAppDeployId = airavataClient.registerApplicationDeployment(new AuthzToken(""), DEFAULT_GATEWAY, RegisterSampleApplicationsUtils.createApplicationDeployment(espressoModuleId, stampedeResourceId, "/home1/01437/ogce/production/app_wrappers/espresso_wrapper.sh", ApplicationParallelismType.MPI, espressoDescription, null, null, null));
        System.out.println("ESPRESSO on stampede deployment Id " + espressoAppDeployId);
        // Register GROMACS
        String gromacsAppDeployId = airavataClient.registerApplicationDeployment(new AuthzToken(""), DEFAULT_GATEWAY, RegisterSampleApplicationsUtils.createApplicationDeployment(gromacsModuleId, stampedeResourceId, "/home1/01437/ogce/production/app_wrappers/gromacs_wrapper.sh", ApplicationParallelismType.MPI, gromacsDescription, null, null, null));
        System.out.println("GROMACS on stampede deployment Id " + gromacsAppDeployId);
        // Register LAMMPS
        List<CommandObject> preJobCommands = new ArrayList();
        preJobCommands.add(new CommandObject("cp /home1/00421/ccguser/apps/ds_lammps/data/* $workingDir"));
        String lammpsAppDeployId = airavataClient.registerApplicationDeployment(new AuthzToken(""), DEFAULT_GATEWAY, RegisterSampleApplicationsUtils.createApplicationDeployment(lammpsModuleId, stampedeResourceId, "~/apps/ds_lammps/bin/lmp_stampede", ApplicationParallelismType.MPI, lammpsDescription, null, preJobCommands, null));
        System.out.println("LAMMPS on stampede deployment Id " + lammpsAppDeployId);
        // Register NWChem
        List<CommandObject> nwChemModuleCmds = new ArrayList();
        nwChemModuleCmds.add(new CommandObject("module load nwchem"));
        String nwChemAppDeployId = airavataClient.registerApplicationDeployment(new AuthzToken(""), DEFAULT_GATEWAY, RegisterSampleApplicationsUtils.createApplicationDeployment(nwChemModuleId, stampedeResourceId, "nwchem", ApplicationParallelismType.MPI, nwChemDescription, nwChemModuleCmds, null, null));
        System.out.println("NWChem on stampede deployment Id " + nwChemAppDeployId);
        // Register Trinity
        String trinityAppDeployId = airavataClient.registerApplicationDeployment(new AuthzToken(""), DEFAULT_GATEWAY, RegisterSampleApplicationsUtils.createApplicationDeployment(trinityModuleId, stampedeResourceId, "/home1/01437/ogce/production/app_wrappers/trinity_wrapper.sh", ApplicationParallelismType.MPI, trinityDescription, null, null, null));
        System.out.println("Trinity on stampede deployment Id " + trinityAppDeployId);
        // Register WRF
        String wrfAppDeployId = airavataClient.registerApplicationDeployment(new AuthzToken(""), DEFAULT_GATEWAY, RegisterSampleApplicationsUtils.createApplicationDeployment(wrfModuleId, stampedeResourceId, "/home1/01437/ogce/production/app_wrappers/wrf_wrapper.sh", ApplicationParallelismType.MPI, wrfDescription, null, null, null));
        System.out.println("WRF on stampede deployment Id " + wrfAppDeployId);
        List<CommandObject> monteXModuleCmds = new ArrayList();
        // monteXModuleCmds.add("module load globus");
        // monteXModuleCmds.add("module load uberftp");
        monteXModuleCmds.add(new CommandObject("module load fftw3"));
        String monteXAppDeployId = airavataClient.registerApplicationDeployment(new AuthzToken(""), DEFAULT_GATEWAY, RegisterSampleApplicationsUtils.createApplicationDeployment(monteXModuleId, stampedeResourceId, "/home1/00421/ccguser/apps/tinker/tinker/bin/monte.x", ApplicationParallelismType.OPENMP, monteXDescription, monteXModuleCmds, null, null));
        System.out.println("Tinker Monte on trestles deployment Id " + monteXAppDeployId);
    } catch (TException e) {
        e.printStackTrace();
    }
}
Also used : CommandObject(org.apache.airavata.model.appcatalog.appdeployment.CommandObject) TException(org.apache.thrift.TException) ApplicationDeploymentDescription(org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription) AuthzToken(org.apache.airavata.model.security.AuthzToken)

Aggregations

CommandObject (org.apache.airavata.model.appcatalog.appdeployment.CommandObject)10 TException (org.apache.thrift.TException)6 AuthzToken (org.apache.airavata.model.security.AuthzToken)5 ApplicationDeploymentDescription (org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription)3 SetEnvPaths (org.apache.airavata.model.appcatalog.appdeployment.SetEnvPaths)3 HashMap (java.util.HashMap)2 ApplicationParallelismType (org.apache.airavata.model.parallelism.ApplicationParallelismType)2 Writable (groovy.lang.Writable)1 GStringTemplateEngine (groovy.text.GStringTemplateEngine)1 TemplateEngine (groovy.text.TemplateEngine)1 java.io (java.io)1 InetAddress (java.net.InetAddress)1 URISyntaxException (java.net.URISyntaxException)1 URL (java.net.URL)1 UnknownHostException (java.net.UnknownHostException)1 ByteBuffer (java.nio.ByteBuffer)1 SecureRandom (java.security.SecureRandom)1 java.util (java.util)1 ArrayList (java.util.ArrayList)1 Matcher (java.util.regex.Matcher)1