use of org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule in project airavata by apache.
the class AiravataIT method testAddApplication.
@org.testng.annotations.Test(priority = 4)
public void testAddApplication() {
try {
logger.info("testAddApplication() -> Adding test application......");
applicationProperties = setup.getApplicationRegister().addApplications();
;
Assert.assertNotNull(applicationProperties);
ApplicationModule applicationModule = setup.getApplicationRegister().getApplicationModule(applicationProperties.getApplicationModuleId());
Assert.assertNotNull(applicationModule);
Assert.assertEquals(applicationModule.getAppModuleName(), TestFrameworkConstants.AppcatalogConstants.LOCAL_ECHO_NAME);
Assert.assertEquals(applicationModule.getAppModuleVersion(), LOCAL_ECHO_VERSION);
Assert.assertEquals(applicationModule.getAppModuleDescription(), TestFrameworkConstants.AppcatalogConstants.LOCAL_ECHO_DESCRIPTION);
Assert.assertEquals(applicationModule.getAppModuleName(), TestFrameworkConstants.AppcatalogConstants.LOCAL_ECHO_NAME);
ApplicationInterfaceDescription applicationInterfaceDescription = setup.getApplicationRegister().getApplicationInterfaceDescription(applicationProperties.getApplicationInterfaceId());
Assert.assertNotNull(applicationInterfaceDescription);
Assert.assertEquals(applicationInterfaceDescription.getApplicationName(), TestFrameworkConstants.AppcatalogConstants.LOCAL_ECHO_NAME);
Assert.assertEquals(applicationInterfaceDescription.getApplicationDescription(), TestFrameworkConstants.AppcatalogConstants.LOCAL_ECHO_DESCRIPTION);
InputDataObjectType input = applicationInterfaceDescription.getApplicationInputs().get(0);
Assert.assertNotNull(input);
Assert.assertEquals(input.getName(), INPUT_NAME);
Assert.assertEquals(input.getValue(), INPUT_VALUE);
Assert.assertEquals(input.getType(), DataType.STRING);
Assert.assertEquals(input.getApplicationArgument(), null);
Assert.assertEquals(input.getInputOrder(), 0);
Assert.assertEquals(input.isIsRequired(), true);
Assert.assertEquals(input.isRequiredToAddedToCommandLine(), true);
Assert.assertEquals(input.isStandardInput(), false);
Assert.assertEquals(input.getUserFriendlyDescription(), INPUT_DESC);
Assert.assertEquals(input.getMetaData(), null);
List<OutputDataObjectType> outputDataObjectTypes = applicationInterfaceDescription.getApplicationOutputs();
Assert.assertNotNull(outputDataObjectTypes.get(0));
Assert.assertEquals(outputDataObjectTypes.get(0).getName(), STDERR_NAME);
Assert.assertEquals(outputDataObjectTypes.get(0).getValue(), STDERR_VALUE);
Assert.assertEquals(outputDataObjectTypes.get(0).getType(), DataType.URI);
Assert.assertEquals(outputDataObjectTypes.get(0).isIsRequired(), true);
Assert.assertEquals(outputDataObjectTypes.get(0).isRequiredToAddedToCommandLine(), true);
Assert.assertEquals(outputDataObjectTypes.get(0).getApplicationArgument(), null);
Assert.assertNotNull(outputDataObjectTypes.get(1));
Assert.assertEquals(outputDataObjectTypes.get(1).getName(), STDOUT_NAME);
Assert.assertEquals(outputDataObjectTypes.get(1).getValue(), STDOUT_VALUE);
Assert.assertEquals(outputDataObjectTypes.get(1).getType(), DataType.URI);
Assert.assertEquals(outputDataObjectTypes.get(1).isIsRequired(), true);
Assert.assertEquals(outputDataObjectTypes.get(1).isRequiredToAddedToCommandLine(), true);
Assert.assertEquals(outputDataObjectTypes.get(1).getApplicationArgument(), null);
ApplicationDeploymentDescription applicationDeploymentDescription = setup.getApplicationRegister().getApplicationDeploymentDescription(applicationProperties.getApplicationDeployId());
Assert.assertNotNull(applicationDeploymentDescription);
Assert.assertEquals(applicationDeploymentDescription.getExecutablePath(), TestFrameworkConstants.LOCAL_ECHO_JOB_FILE_PATH);
Assert.assertEquals(applicationDeploymentDescription.getParallelism(), ApplicationParallelismType.SERIAL);
Assert.assertEquals(applicationDeploymentDescription.getAppDeploymentDescription(), TestFrameworkConstants.AppcatalogConstants.LOCAL_ECHO_DESCRIPTION);
Assert.assertEquals(applicationDeploymentDescription.getModuleLoadCmds(), null);
Assert.assertEquals(applicationDeploymentDescription.getPostJobCommands(), null);
Assert.assertEquals(applicationDeploymentDescription.getPreJobCommands(), null);
logger.info("testAddApplication() -> Adding test application." + applicationProperties.toString());
} catch (Exception e) {
logger.error("Error occured while testAddApplication", e);
Assert.fail();
}
}
use of org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule in project airavata by apache.
the class ApplicationRegister method createApplicationModule.
protected ApplicationModule createApplicationModule(String appModuleName, String appModuleVersion, String appModuleDescription) {
ApplicationModule module = new ApplicationModule();
module.setAppModuleDescription(appModuleDescription);
module.setAppModuleName(appModuleName);
module.setAppModuleVersion(appModuleVersion);
return module;
}
use of org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule in project airavata by apache.
the class RegistryServerHandler method getAllAppModules.
/**
* Fetch all Application Module Descriptions.
*
* @param gatewayId ID of the gateway which need to list all available application deployment documentation.
* @return list
* Returns the list of all Application Module Objects.
*/
@Override
public List<ApplicationModule> getAllAppModules(String gatewayId) throws RegistryServiceException, TException {
if (!isGatewayExistInternal(gatewayId)) {
logger.error("Gateway does not exist.Please provide a valid gateway id...");
throw new RegistryServiceException("Gateway does not exist.Please provide a valid gateway id...");
}
try {
appCatalog = RegistryFactory.getAppCatalog();
List<ApplicationModule> moduleList = appCatalog.getApplicationInterface().getAllApplicationModules(gatewayId);
logger.debug("Airavata retrieved modules for gateway id : " + gatewayId);
return moduleList;
} catch (AppCatalogException e) {
logger.error("Error while retrieving all application modules...", e);
RegistryServiceException exception = new RegistryServiceException();
exception.setMessage("Error while retrieving all application modules. More info : " + e.getMessage());
throw exception;
}
}
use of org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule in project airavata by apache.
the class DocumentCreatorNew method createStampedeAmberDocs.
public String createStampedeAmberDocs() throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException, AppCatalogException {
ComputeResourceDescription host = DocumentCreatorUtils.createComputeResourceDescription(stampedeHostAddress, null, null);
host.addToHostAliases(stampedeHostAddress);
host.addToIpAddresses(stampedeHostAddress);
host.setComputeResourceId(client.registerComputeResource(authzToken, host));
ResourceJobManager resourceJobManager = DocumentCreatorUtils.createResourceJobManager(ResourceJobManagerType.SLURM, "/usr/bin/", null, "push");
SSHJobSubmission sshJobSubmission = new SSHJobSubmission();
sshJobSubmission.setResourceJobManager(resourceJobManager);
sshJobSubmission.setSecurityProtocol(SecurityProtocol.GSI);
sshJobSubmission.setSshPort(2222);
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("AmberBR2");
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(), "/home1/01437/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(), "/home1/01437/ogce", "TG-STA110014S", false, null, null, null));
return host.getComputeResourceId() + "," + application.getApplicationInterfaceId();
}
use of org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule in project airavata by apache.
the class DocumentCreatorNew method createLocalHostDocs.
public String createLocalHostDocs() throws AppCatalogException, InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
// Define compute resource host
ComputeResourceDescription host = DocumentCreatorUtils.createComputeResourceDescription("localhost", new ArrayList<String>(Arrays.asList(new String[] { "127.0.0.1" })), new ArrayList<String>(Arrays.asList(new String[] { "127.0.0.1" })));
// host.setIsEmpty(true);
host.setComputeResourceId(client.registerComputeResource(authzToken, host));
LOCALSubmission localSubmission = new LOCALSubmission();
ResourceJobManager resourceJobManager = DocumentCreatorUtils.createResourceJobManager(ResourceJobManagerType.FORK, null, null, null);
localSubmission.setResourceJobManager(resourceJobManager);
client.addLocalSubmissionDetails(authzToken, host.getComputeResourceId(), 1, localSubmission);
LOCALDataMovement localDataMovement = new LOCALDataMovement();
client.addLocalDataMovementDetails(authzToken, host.getComputeResourceId(), 1, localDataMovement);
// Define application module
ApplicationModule module = DocumentCreatorUtils.createApplicationModule("echo", "1.0.0", "Local host echo applications");
module.setAppModuleId(client.registerApplicationModule(authzToken, DEFAULT_GATEWAY, module));
// Define application interfaces
ApplicationInterfaceDescription application = new ApplicationInterfaceDescription();
// application.setIsEmpty(false);
application.setApplicationName("SimpleEcho0");
application.addToApplicationModules(module.getAppModuleId());
application.addToApplicationInputs(DocumentCreatorUtils.createAppInput("echo_input", "echo_input", "Echo Input Data", null, DataType.STRING));
application.addToApplicationOutputs(DocumentCreatorUtils.createAppOutput("echo_output", null, DataType.STRING));
application.setApplicationInterfaceId(client.registerApplicationInterface(authzToken, DEFAULT_GATEWAY, application));
// Define application deployment
ApplicationDeploymentDescription deployment = DocumentCreatorUtils.createApplicationDeployment(host.getComputeResourceId(), module.getAppModuleId(), "/bin/echo", ApplicationParallelismType.SERIAL, "Local echo app depoyment");
deployment.setAppDeploymentId(client.registerApplicationDeployment(authzToken, DEFAULT_GATEWAY, deployment));
// Define gateway profile
ComputeResourcePreference computeResourcePreference = DocumentCreatorUtils.createComputeResourcePreference(host.getComputeResourceId(), "/tmp", null, false, null, null, null);
gatewayResourceProfile = new GatewayResourceProfile();
// gatewayResourceProfile.setGatewayID("default");
gatewayResourceProfile.setGatewayID(DEFAULT_GATEWAY);
gatewayResourceProfile.addToComputeResourcePreferences(computeResourcePreference);
String gatewayId = client.registerGatewayResourceProfile(authzToken, gatewayResourceProfile);
gatewayResourceProfile.setGatewayID(gatewayId);
client.addGatewayComputeResourcePreference(authzToken, gatewayResourceProfile.getGatewayID(), host.getComputeResourceId(), computeResourcePreference);
return host.getComputeResourceId() + "," + application.getApplicationInterfaceId();
}
Aggregations