Search in sources :

Example 16 with ApplicationModule

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

the class DocumentCreatorUtils method createApplicationModule.

public static ApplicationModule createApplicationModule(String appModuleName, String appModuleVersion, String appModuleDescription) {
    ApplicationModule module = new ApplicationModule();
    module.setAppModuleDescription(appModuleDescription);
    module.setAppModuleName(appModuleName);
    module.setAppModuleVersion(appModuleVersion);
    return module;
}
Also used : ApplicationModule(org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule)

Example 17 with ApplicationModule

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

the class DocumentCreatorNew method createSSHHostDocs.

public String createSSHHostDocs() throws AppCatalogException, InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
    ComputeResourceDescription host = DocumentCreatorUtils.createComputeResourceDescription("gw111.iu.xsede.org", null, null);
    host.addToIpAddresses("gw111.iu.xsede.org");
    host.addToHostAliases("gw111.iu.xsede.org");
    host.setResourceDescription("gw111 ssh access");
    host.setComputeResourceId(client.registerComputeResource(authzToken, host));
    SSHJobSubmission jobSubmission = new SSHJobSubmission();
    jobSubmission.setSshPort(22);
    jobSubmission.setSecurityProtocol(SecurityProtocol.SSH_KEYS);
    ResourceJobManager resourceJobManager = DocumentCreatorUtils.createResourceJobManager(ResourceJobManagerType.FORK, null, null, null);
    jobSubmission.setResourceJobManager(resourceJobManager);
    client.addSSHJobSubmissionDetails(authzToken, host.getComputeResourceId(), 1, jobSubmission);
    SCPDataMovement scpDataMovement = new SCPDataMovement();
    scpDataMovement.setSecurityProtocol(SecurityProtocol.SSH_KEYS);
    scpDataMovement.setSshPort(22);
    client.addSCPDataMovementDetails(authzToken, host.getComputeResourceId(), 1, scpDataMovement);
    ApplicationModule module = DocumentCreatorUtils.createApplicationModule("echo", "1.1", null);
    module.setAppModuleId(client.registerApplicationModule(authzToken, DEFAULT_GATEWAY, module));
    ApplicationDeploymentDescription deployment = DocumentCreatorUtils.createApplicationDeployment(host.getComputeResourceId(), module.getAppModuleId(), "/bin/echo", ApplicationParallelismType.SERIAL, "SSHEchoApplication");
    client.registerApplicationDeployment(authzToken, DEFAULT_GATEWAY, deployment);
    ApplicationInterfaceDescription application = new ApplicationInterfaceDescription();
    // application.setIsEmpty(false);
    application.setApplicationName("SSHEcho1");
    application.addToApplicationModules(module.getAppModuleId());
    application.addToApplicationInputs(DocumentCreatorUtils.createAppInput("echo_input", "echo_input", null, null, DataType.STRING));
    application.addToApplicationOutputs(DocumentCreatorUtils.createAppOutput("echo_output", null, DataType.STRING));
    client.registerApplicationInterface(authzToken, DEFAULT_GATEWAY, application);
    client.addGatewayComputeResourcePreference(authzToken, getGatewayResourceProfile().getGatewayID(), host.getComputeResourceId(), DocumentCreatorUtils.createComputeResourcePreference(host.getComputeResourceId(), "/tmp", null, false, null, null, null));
    return host.getComputeResourceId() + "," + application.getApplicationInterfaceId();
}
Also used : ApplicationDeploymentDescription(org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription) ComputeResourceDescription(org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescription) ResourceJobManager(org.apache.airavata.model.appcatalog.computeresource.ResourceJobManager) ApplicationInterfaceDescription(org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription) SSHJobSubmission(org.apache.airavata.model.appcatalog.computeresource.SSHJobSubmission) ApplicationModule(org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule)

Example 18 with ApplicationModule

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

the class DocumentCreatorNew method createTrestlesAmberDocs.

public String createTrestlesAmberDocs() throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException, AppCatalogException {
    ComputeResourceDescription host = DocumentCreatorUtils.createComputeResourceDescription(trestleshpcHostAddress, null, null);
    host.addToIpAddresses(trestleshpcHostAddress);
    host.addToHostAliases(trestleshpcHostAddress);
    host.setComputeResourceId(client.registerComputeResource(authzToken, host));
    SSHJobSubmission sshJobSubmission = new SSHJobSubmission();
    ResourceJobManager resourceJobManager = DocumentCreatorUtils.createResourceJobManager(ResourceJobManagerType.PBS, "/opt/torque/bin/", null, null);
    sshJobSubmission.setResourceJobManager(resourceJobManager);
    sshJobSubmission.setSecurityProtocol(SecurityProtocol.GSI);
    sshJobSubmission.setSshPort(22);
    client.addSSHJobSubmissionDetails(authzToken, host.getComputeResourceId(), 1, sshJobSubmission);
    SCPDataMovement scpDataMovement = new SCPDataMovement();
    scpDataMovement.setSecurityProtocol(SecurityProtocol.GSI);
    scpDataMovement.setSshPort(22);
    client.addSCPDataMovementDetails(authzToken, host.getComputeResourceId(), 1, scpDataMovement);
    ApplicationModule amodule = DocumentCreatorUtils.createApplicationModule("Amber", "12.0", null);
    amodule.setAppModuleId(client.registerApplicationModule(authzToken, DEFAULT_GATEWAY, amodule));
    ApplicationInterfaceDescription application = new ApplicationInterfaceDescription();
    application.setApplicationName("AmberTrestles");
    application.addToApplicationModules(amodule.getAppModuleId());
    application.addToApplicationInputs(DocumentCreatorUtils.createAppInput("AMBER_HEAT_RST", "AMBER_HEAT_RST", null, null, DataType.URI));
    application.addToApplicationInputs(DocumentCreatorUtils.createAppInput("AMBER_PROD_IN", "AMBER_PROD_IN", null, null, DataType.URI));
    application.addToApplicationInputs(DocumentCreatorUtils.createAppInput("AMBER_PRMTOP", "AMBER_PRMTOP", null, null, DataType.URI));
    application.addToApplicationOutputs(DocumentCreatorUtils.createAppOutput("AMBER_Prod.info", null, DataType.URI));
    application.addToApplicationOutputs(DocumentCreatorUtils.createAppOutput("AMBER_Prod.mdcrd", null, DataType.URI));
    application.addToApplicationOutputs(DocumentCreatorUtils.createAppOutput("AMBER_Prod.out", null, DataType.URI));
    application.addToApplicationOutputs(DocumentCreatorUtils.createAppOutput("AMBER_Prod.rst", null, DataType.URI));
    application.setApplicationInterfaceId(client.registerApplicationInterface(authzToken, DEFAULT_GATEWAY, application));
    ApplicationDeploymentDescription deployment = DocumentCreatorUtils.createApplicationDeployment(host.getComputeResourceId(), amodule.getAppModuleId(), "/home/ogce/production/app_wrappers/amber_wrapper.sh", ApplicationParallelismType.SERIAL, "AmberStampede");
    deployment.setAppDeploymentId(client.registerApplicationDeployment(authzToken, DEFAULT_GATEWAY, deployment));
    client.addGatewayComputeResourcePreference(authzToken, getGatewayResourceProfile().getGatewayID(), host.getComputeResourceId(), DocumentCreatorUtils.createComputeResourcePreference(host.getComputeResourceId(), "/oasis/scratch/trestles/ogce/temp_project/", "sds128", false, null, null, null));
    return host.getComputeResourceId() + "," + application.getApplicationInterfaceId();
}
Also used : ApplicationDeploymentDescription(org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription) ComputeResourceDescription(org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescription) ResourceJobManager(org.apache.airavata.model.appcatalog.computeresource.ResourceJobManager) ApplicationInterfaceDescription(org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription) SSHJobSubmission(org.apache.airavata.model.appcatalog.computeresource.SSHJobSubmission) ApplicationModule(org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule)

Example 19 with ApplicationModule

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

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

the class AppInterfaceTest method testAppInterface.

@Test
public void testAppInterface() {
    try {
        ApplicationInterface appInterface = appcatalog.getApplicationInterface();
        ApplicationInterfaceDescription description = new ApplicationInterfaceDescription();
        String wrfModuleId = addAppModule("WRF");
        String amberModuleId = addAppModule("AMBER");
        List<String> modules = new ArrayList<String>();
        modules.add(wrfModuleId);
        modules.add(amberModuleId);
        InputDataObjectType appInput1 = createAppInput("input1", "input1", DataType.STRING);
        InputDataObjectType appInput2 = createAppInput("input2", "input2", DataType.INTEGER);
        List<InputDataObjectType> inputs = new ArrayList<InputDataObjectType>();
        inputs.add(appInput1);
        inputs.add(appInput2);
        OutputDataObjectType output1 = createAppOutput("output1", "", DataType.STRING);
        OutputDataObjectType output2 = createAppOutput("output2", "", DataType.STRING);
        List<OutputDataObjectType> outputs = new ArrayList<OutputDataObjectType>();
        outputs.add(output1);
        outputs.add(output2);
        description.setApplicationName("testApplication");
        description.setApplicationDescription("my testApplication");
        description.setApplicationModules(modules);
        description.setApplicationInputs(inputs);
        description.setApplicationOutputs(outputs);
        String appID = appInterface.addApplicationInterface(description, ServerSettings.getDefaultUserGateway());
        System.out.println("********** application id ************* : " + appID);
        ApplicationInterfaceDescription ainterface = null;
        if (appInterface.isApplicationInterfaceExists(appID)) {
            ainterface = appInterface.getApplicationInterface(appID);
            OutputDataObjectType output3 = createAppOutput("output3", "", DataType.STRING);
            OutputDataObjectType output4 = createAppOutput("output4", "", DataType.STRING);
            outputs.add(output3);
            outputs.add(output4);
            ainterface.setApplicationOutputs(outputs);
            appInterface.updateApplicationInterface(appID, ainterface);
            ApplicationInterfaceDescription updateApp = appInterface.getApplicationInterface(appID);
            List<OutputDataObjectType> appOutputs = updateApp.getApplicationOutputs();
            System.out.println("********** application name ************* : " + updateApp.getApplicationName());
            System.out.println("********** application description ************* : " + updateApp.getApplicationDescription());
            System.out.println("********** output size ************* : " + appOutputs.size());
        }
        ApplicationModule wrfModule = appInterface.getApplicationModule(wrfModuleId);
        System.out.println("********** WRF module name ************* : " + wrfModule.getAppModuleName());
        ApplicationModule amberModule = appInterface.getApplicationModule(amberModuleId);
        System.out.println("********** Amber module name ************* : " + amberModule.getAppModuleName());
        List<InputDataObjectType> applicationInputs = appInterface.getApplicationInputs(appID);
        System.out.println("********** App Input size ************* : " + applicationInputs.size());
        List<OutputDataObjectType> applicationOutputs = appInterface.getApplicationOutputs(appID);
        System.out.println("********** App output size ************* : " + applicationOutputs.size());
        description.setApplicationName("testApplication2");
        appInterface.updateApplicationInterface(appID, description);
        if (appInterface.isApplicationInterfaceExists(appID)) {
            ainterface = appInterface.getApplicationInterface(appID);
            System.out.println("********** updated application name ************* : " + ainterface.getApplicationName());
        }
        wrfModule.setAppModuleVersion("1.0.1");
        appInterface.updateApplicationModule(wrfModuleId, wrfModule);
        wrfModule = appInterface.getApplicationModule(wrfModuleId);
        System.out.println("********** Updated WRF module version ************* : " + wrfModule.getAppModuleVersion());
        Map<String, String> filters = new HashMap<String, String>();
        filters.put(AppCatAbstractResource.ApplicationInterfaceConstants.APPLICATION_NAME, "testApplication2");
        List<ApplicationInterfaceDescription> apps = appInterface.getApplicationInterfaces(filters);
        System.out.println("********** Size og app interfaces ************* : " + apps.size());
        List<ApplicationInterfaceDescription> appInts = appInterface.getAllApplicationInterfaces(ServerSettings.getDefaultUserGateway());
        System.out.println("********** Size of all app interfaces ************* : " + appInts.size());
        List<String> appIntIds = appInterface.getAllApplicationInterfaceIds();
        System.out.println("********** Size of all app interface ids ************* : " + appIntIds.size());
        assertTrue("App interface saved successfully", ainterface != null);
    } catch (AppCatalogException e) {
        e.printStackTrace();
    } catch (ApplicationSettingsException e) {
        e.printStackTrace();
    }
}
Also used : ApplicationSettingsException(org.apache.airavata.common.exception.ApplicationSettingsException) HashMap(java.util.HashMap) InputDataObjectType(org.apache.airavata.model.application.io.InputDataObjectType) ArrayList(java.util.ArrayList) ApplicationModule(org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule) AppCatalogException(org.apache.airavata.registry.cpi.AppCatalogException) OutputDataObjectType(org.apache.airavata.model.application.io.OutputDataObjectType) ApplicationInterface(org.apache.airavata.registry.cpi.ApplicationInterface) ApplicationInterfaceDescription(org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription) Test(org.junit.Test)

Aggregations

ApplicationModule (org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule)24 ApplicationDeploymentDescription (org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription)13 ApplicationInterfaceDescription (org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription)13 ComputeResourceDescription (org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescription)12 ResourceJobManager (org.apache.airavata.model.appcatalog.computeresource.ResourceJobManager)11 SSHJobSubmission (org.apache.airavata.model.appcatalog.computeresource.SSHJobSubmission)10 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 ApplicationSettingsException (org.apache.airavata.common.exception.ApplicationSettingsException)3 RegistryServiceException (org.apache.airavata.registry.api.exception.RegistryServiceException)3 AppCatalogException (org.apache.airavata.registry.cpi.AppCatalogException)3 JobManagerCommand (org.apache.airavata.model.appcatalog.computeresource.JobManagerCommand)2 InputDataObjectType (org.apache.airavata.model.application.io.InputDataObjectType)2 OutputDataObjectType (org.apache.airavata.model.application.io.OutputDataObjectType)2 TException (org.apache.thrift.TException)2 Test (org.junit.Test)2 List (java.util.List)1 Scanner (java.util.Scanner)1 Airavata (org.apache.airavata.api.Airavata)1 AiravataException (org.apache.airavata.common.exception.AiravataException)1