Search in sources :

Example 31 with ApplicationDeploymentDescription

use of org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription 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 32 with ApplicationDeploymentDescription

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

the class RegistryServerHandler method getApplicationDeployment.

/**
 * Fetch a Application Deployment.
 *
 * @param appDeploymentId The identifier for the requested application module
 * @return applicationDeployment
 * Returns a application Deployment Object.
 */
@Override
public ApplicationDeploymentDescription getApplicationDeployment(String appDeploymentId) throws RegistryServiceException, TException {
    try {
        appCatalog = RegistryFactory.getAppCatalog();
        ApplicationDeploymentDescription deployement = appCatalog.getApplicationDeployment().getApplicationDeployement(appDeploymentId);
        logger.debug("Airavata registered application deployment for deployment id : " + appDeploymentId);
        return deployement;
    } catch (AppCatalogException e) {
        logger.error(appDeploymentId, "Error while retrieving application deployment...", e);
        RegistryServiceException exception = new RegistryServiceException();
        exception.setMessage("Error while retrieving application deployment. More info : " + e.getMessage());
        throw exception;
    }
}
Also used : ApplicationDeploymentDescription(org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription) RegistryServiceException(org.apache.airavata.registry.api.exception.RegistryServiceException)

Example 33 with ApplicationDeploymentDescription

use of org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription 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)

Example 34 with ApplicationDeploymentDescription

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

the class ApplicationRegister method createApplicationDeployment.

protected ApplicationDeploymentDescription createApplicationDeployment(String appModuleId, String computeResourceId, String executablePath, ApplicationParallelismType parallelism, String appDeploymentDescription, List<CommandObject> moduleLoadCmds, List<CommandObject> preJobCmds, List<CommandObject> postJobCmds) {
    ApplicationDeploymentDescription deployment = new ApplicationDeploymentDescription();
    deployment.setAppDeploymentDescription(appDeploymentDescription);
    deployment.setAppModuleId(appModuleId);
    deployment.setComputeHostId(computeResourceId);
    deployment.setExecutablePath(executablePath);
    deployment.setParallelism(parallelism);
    deployment.setModuleLoadCmds(moduleLoadCmds);
    deployment.setPreJobCommands(preJobCmds);
    deployment.setPostJobCommands(postJobCmds);
    return deployment;
}
Also used : ApplicationDeploymentDescription(org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription)

Aggregations

ApplicationDeploymentDescription (org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription)34 ApplicationModule (org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule)13 ApplicationInterfaceDescription (org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription)13 ComputeResourceDescription (org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescription)13 ResourceJobManager (org.apache.airavata.model.appcatalog.computeresource.ResourceJobManager)11 SSHJobSubmission (org.apache.airavata.model.appcatalog.computeresource.SSHJobSubmission)10 RegistryServiceException (org.apache.airavata.registry.api.exception.RegistryServiceException)5 TException (org.apache.thrift.TException)4 ArrayList (java.util.ArrayList)3 ApplicationSettingsException (org.apache.airavata.common.exception.ApplicationSettingsException)3 ApplicationParallelismType (org.apache.airavata.model.parallelism.ApplicationParallelismType)3 AiravataException (org.apache.airavata.common.exception.AiravataException)2 CommandObject (org.apache.airavata.model.appcatalog.appdeployment.CommandObject)2 JobManagerCommand (org.apache.airavata.model.appcatalog.computeresource.JobManagerCommand)2 ComputeResourcePreference (org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference)2 InputDataObjectType (org.apache.airavata.model.application.io.InputDataObjectType)2 OutputDataObjectType (org.apache.airavata.model.application.io.OutputDataObjectType)2 AppCatalogException (org.apache.airavata.registry.cpi.AppCatalogException)2 Writable (groovy.lang.Writable)1 GStringTemplateEngine (groovy.text.GStringTemplateEngine)1