Search in sources :

Example 6 with SetEnvPaths

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

the class AppDeploymentTest method createSetEnvPath.

public SetEnvPaths createSetEnvPath(String name, String val, int order) {
    SetEnvPaths setEnvPaths = new SetEnvPaths();
    setEnvPaths.setName(name);
    setEnvPaths.setValue(val);
    setEnvPaths.setEnvPathOrder(order);
    return setEnvPaths;
}
Also used : SetEnvPaths(org.apache.airavata.model.appcatalog.appdeployment.SetEnvPaths)

Example 7 with SetEnvPaths

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

Aggregations

SetEnvPaths (org.apache.airavata.model.appcatalog.appdeployment.SetEnvPaths)7 CommandObject (org.apache.airavata.model.appcatalog.appdeployment.CommandObject)3 HashMap (java.util.HashMap)2 AppCatalogException (org.apache.airavata.registry.cpi.AppCatalogException)2 ArrayList (java.util.ArrayList)1 ApplicationDeploymentDescription (org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription)1 ApplicationModule (org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule)1 ComputeResourceDescription (org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescription)1 ApplicationParallelismType (org.apache.airavata.model.parallelism.ApplicationParallelismType)1 Test (org.junit.Test)1