Search in sources :

Example 1 with JobManagerCommand

use of org.apache.airavata.model.appcatalog.computeresource.JobManagerCommand in project airavata by apache.

the class DocumentCreatorNew method createBigRedDocs.

// public void createEchoHostDocs() {
// String serviceName = "Echo";
// ServiceDescription serviceDescription = new ServiceDescription();
// List<InputParameterType> inputParameters = new ArrayList<InputParameterType>();
// List<OutputParameterType> outputParameters = new ArrayList<OutputParameterType>();
// serviceDescription.getType().setName(serviceName);
// serviceDescription.getType().setDescription("Echo service");
// // Creating input parameters
// InputParameterType parameter = InputParameterType.Factory.newInstance();
// parameter.setParameterName("echo_input");
// parameter.setParameterDescription("echo input");
// ParameterType parameterType = parameter.addNewParameterType();
// parameterType.setType(DataType.STRING);
// parameterType.setName("String");
// inputParameters.add(parameter);
// 
// // Creating output parameters
// OutputParameterType outputParameter = OutputParameterType.Factory.newInstance();
// outputParameter.setParameterName("echo_output");
// outputParameter.setParameterDescription("Echo output");
// ParameterType outputParaType = outputParameter.addNewParameterType();
// outputParaType.setType(DataType.STRING);
// outputParaType.setName("String");
// outputParameters.add(outputParameter);
// 
// // Setting input and output parameters to serviceDescriptor
// serviceDescription.getType().setInputParametersArray(inputParameters.toArray(new InputParameterType[] {}));
// serviceDescription.getType().setOutputParametersArray(outputParameters.toArray(new OutputParameterType[] {}));
// 
// try {
// airavataAPI.getApplicationManager().saveServiceDescription(serviceDescription);
// } catch (AiravataAPIInvocationException e) {
// e.printStackTrace(); // To change body of catch statement use File |
// // Settings | File Templates.
// }
// // Localhost
// ApplicationDescription applicationDeploymentDescription = new ApplicationDescription();
// ApplicationDeploymentDescriptionType applicationDeploymentDescriptionType = applicationDeploymentDescription.getType();
// applicationDeploymentDescriptionType.addNewApplicationName().setStringValue(serviceName);
// applicationDeploymentDescriptionType.setExecutableLocation("/bin/echo");
// applicationDeploymentDescriptionType.setScratchWorkingDirectory("/tmp");
// 
// try {
// airavataAPI.getApplicationManager().saveApplicationDescription(serviceName, "localhost", applicationDeploymentDescription);
// } catch (AiravataAPIInvocationException e) {
// e.printStackTrace(); // To change body of catch statement use File |
// // Settings | File Templates.
// }
// // Stampede
// /*
// * Application descriptor creation and saving
// */
// ApplicationDescription appDesc1 = new ApplicationDescription(HpcApplicationDeploymentType.type);
// HpcApplicationDeploymentType app1 = (HpcApplicationDeploymentType) appDesc1.getType();
// ApplicationDeploymentDescriptionType.ApplicationName name = ApplicationDeploymentDescriptionType.ApplicationName.Factory.newInstance();
// name.setStringValue(serviceName);
// app1.setApplicationName(name);
// ProjectAccountType projectAccountType = app1.addNewProjectAccount();
// projectAccountType.setProjectAccountNumber("TG-STA110014S");
// 
// QueueType queueType = app1.addNewQueue();
// queueType.setQueueName("normal");
// 
// app1.setCpuCount(1);
// app1.setJobType(JobTypeType.SERIAL);
// app1.setNodeCount(1);
// app1.setProcessorsPerNode(1);
// app1.setMaxWallTime(10);
// /*
// * Use bat file if it is compiled on Windows
// */
// app1.setExecutableLocation("/bin/echo");
// 
// /*
// * Default tmp location
// */
// String tempDir = "/home1/01437/ogce";
// 
// app1.setScratchWorkingDirectory(tempDir);
// app1.setInstalledParentPath("/usr/bin/");
// 
// try {
// airavataAPI.getApplicationManager().saveApplicationDescription(serviceName, stampedeHostAddress, appDesc1);
// } catch (AiravataAPIInvocationException e) {
// e.printStackTrace(); // To change body of catch statement use File |
// // Settings | File Templates.
// }
// // Trestles
// /*
// * Application descriptor creation and saving
// */
// ApplicationDescription appDesc2 = new ApplicationDescription(HpcApplicationDeploymentType.type);
// HpcApplicationDeploymentType app2 = (HpcApplicationDeploymentType) appDesc2.getType();
// ApplicationDeploymentDescriptionType.ApplicationName name2 = ApplicationDeploymentDescriptionType.ApplicationName.Factory.newInstance();
// name2.setStringValue(serviceName);
// app2.setApplicationName(name);
// ProjectAccountType projectAccountType2 = app2.addNewProjectAccount();
// projectAccountType2.setProjectAccountNumber("sds128");
// 
// QueueType queueType2 = app2.addNewQueue();
// queueType2.setQueueName("normal");
// 
// app2.setCpuCount(1);
// app2.setJobType(JobTypeType.SERIAL);
// app2.setNodeCount(1);
// app2.setProcessorsPerNode(1);
// app2.setMaxWallTime(10);
// /*
// * Use bat file if it is compiled on Windows
// */
// app2.setExecutableLocation("/bin/echo");
// 
// /*
// * Default tmp location
// */
// String tempDir2 = "/home/ogce/scratch";
// 
// app2.setScratchWorkingDirectory(tempDir2);
// app2.setInstalledParentPath("/opt/torque/bin/");
// 
// try {
// airavataAPI.getApplicationManager().saveApplicationDescription(serviceName, trestleshpcHostAddress, appDesc2);
// } catch (AiravataAPIInvocationException e) {
// e.printStackTrace(); // To change body of catch statement use File |
// // Settings | File Templates.
// }
// // Lonestar
// /*
// * Application descriptor creation and saving
// */
// ApplicationDescription appDesc3 = new ApplicationDescription(HpcApplicationDeploymentType.type);
// HpcApplicationDeploymentType app3 = (HpcApplicationDeploymentType) appDesc3.getType();
// ApplicationDeploymentDescriptionType.ApplicationName name3 = ApplicationDeploymentDescriptionType.ApplicationName.Factory.newInstance();
// name3.setStringValue(serviceName);
// app3.setApplicationName(name);
// ProjectAccountType projectAccountType3 = app3.addNewProjectAccount();
// projectAccountType3.setProjectAccountNumber("TG-STA110014S");
// 
// QueueType queueType3 = app3.addNewQueue();
// queueType3.setQueueName("normal");
// 
// app3.setCpuCount(1);
// app3.setJobType(JobTypeType.SERIAL);
// app3.setNodeCount(1);
// app3.setProcessorsPerNode(1);
// app3.setMaxWallTime(10);
// /*
// * Use bat file if it is compiled on Windows
// */
// app3.setExecutableLocation("/bin/echo");
// 
// /*
// * Default tmp location
// */
// String tempDir3 = "/home1/01437/ogce";
// 
// app3.setScratchWorkingDirectory(tempDir3);
// app3.setInstalledParentPath("/opt/sge6.2/bin/lx24-amd64/");
// 
// try {
// airavataAPI.getApplicationManager().saveApplicationDescription(serviceName, lonestarHostAddress, appDesc3);
// } catch (AiravataAPIInvocationException e) {
// e.printStackTrace(); // To change body of catch statement use File |
// // Settings | File Templates.
// }
// 
// }
public String createBigRedDocs() throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException, AppCatalogException {
    ComputeResourceDescription host = DocumentCreatorUtils.createComputeResourceDescription("bigred2", null, null);
    host.addToHostAliases(bigRed2HostAddress);
    host.addToIpAddresses(bigRed2HostAddress);
    host.setComputeResourceId(client.registerComputeResource(authzToken, host));
    Map<JobManagerCommand, String> commands = new HashMap<JobManagerCommand, String>();
    commands.put(JobManagerCommand.SUBMISSION, "aprun -n");
    ResourceJobManager resourceJobManager = DocumentCreatorUtils.createResourceJobManager(ResourceJobManagerType.UGE, "/opt/torque/torque-4.2.3.1/bin/", commands, null);
    SSHJobSubmission sshJobSubmission = new SSHJobSubmission();
    sshJobSubmission.setResourceJobManager(resourceJobManager);
    sshJobSubmission.setSecurityProtocol(SecurityProtocol.SSH_KEYS);
    sshJobSubmission.setSshPort(22);
    client.addSSHJobSubmissionDetails(authzToken, host.getComputeResourceId(), 1, sshJobSubmission);
    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.5", null);
    module.setAppModuleId(client.registerApplicationModule(authzToken, DEFAULT_GATEWAY, module));
    ApplicationInterfaceDescription application = new ApplicationInterfaceDescription();
    application.setApplicationName("SimpleEchoBR");
    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));
    application.setApplicationInterfaceId(client.registerApplicationInterface(authzToken, DEFAULT_GATEWAY, application));
    ApplicationDeploymentDescription deployment = DocumentCreatorUtils.createApplicationDeployment(host.getComputeResourceId(), module.getAppModuleId(), "/N/u/lginnali/BigRed2/myjob/test.sh", ApplicationParallelismType.SERIAL, "EchoLocal");
    deployment.setAppDeploymentId(client.registerApplicationDeployment(authzToken, DEFAULT_GATEWAY, deployment));
    String date = (new Date()).toString();
    date = date.replaceAll(" ", "_");
    date = date.replaceAll(":", "_");
    String tempDir = "/N/u/lginnali/BigRed2/myjob";
    tempDir = tempDir + File.separator + "SimpleEcho" + "_" + date + "_" + UUID.randomUUID();
    client.addGatewayComputeResourcePreference(authzToken, getGatewayResourceProfile().getGatewayID(), host.getComputeResourceId(), DocumentCreatorUtils.createComputeResourcePreference(host.getComputeResourceId(), tempDir, "TG-STA110014S", 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) JobManagerCommand(org.apache.airavata.model.appcatalog.computeresource.JobManagerCommand) SSHJobSubmission(org.apache.airavata.model.appcatalog.computeresource.SSHJobSubmission) ApplicationModule(org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule)

Example 2 with JobManagerCommand

use of org.apache.airavata.model.appcatalog.computeresource.JobManagerCommand in project airavata by apache.

the class DocumentCreatorNew method createBigRedAmberDocs.

public String createBigRedAmberDocs() throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException, AppCatalogException {
    ComputeResourceDescription host = DocumentCreatorUtils.createComputeResourceDescription("bigred2", null, null);
    host.addToHostAliases(bigRed2HostAddress);
    host.addToIpAddresses(bigRed2HostAddress);
    host.setComputeResourceId(client.registerComputeResource(authzToken, host));
    Map<JobManagerCommand, String> commands = new HashMap<JobManagerCommand, String>();
    commands.put(JobManagerCommand.SUBMISSION, "aprun -n 4");
    ResourceJobManager resourceJobManager = DocumentCreatorUtils.createResourceJobManager(ResourceJobManagerType.UGE, "/opt/torque/torque-4.2.3.1/bin/", commands, null);
    SSHJobSubmission sshJobSubmission = new SSHJobSubmission();
    sshJobSubmission.setResourceJobManager(resourceJobManager);
    sshJobSubmission.setSecurityProtocol(SecurityProtocol.SSH_KEYS);
    sshJobSubmission.setSshPort(22);
    client.addSSHJobSubmissionDetails(authzToken, host.getComputeResourceId(), 1, sshJobSubmission);
    SCPDataMovement scpDataMovement = new SCPDataMovement();
    scpDataMovement.setSecurityProtocol(SecurityProtocol.SSH_KEYS);
    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(), "/N/u/cgateway/BigRed2/sandbox/amber_wrapper.sh", ApplicationParallelismType.SERIAL, "AmberBR2");
    deployment.setAppDeploymentId(client.registerApplicationDeployment(authzToken, DEFAULT_GATEWAY, deployment));
    String date = (new Date()).toString();
    date = date.replaceAll(" ", "_");
    date = date.replaceAll(":", "_");
    String tempDir = "/N/u/cgateway/BigRed2/sandbox/jobs";
    tempDir = tempDir + File.separator + "Amber";
    client.addGatewayComputeResourcePreference(authzToken, getGatewayResourceProfile().getGatewayID(), host.getComputeResourceId(), DocumentCreatorUtils.createComputeResourcePreference(host.getComputeResourceId(), tempDir, 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) JobManagerCommand(org.apache.airavata.model.appcatalog.computeresource.JobManagerCommand) SSHJobSubmission(org.apache.airavata.model.appcatalog.computeresource.SSHJobSubmission) ApplicationModule(org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule)

Aggregations

ApplicationDeploymentDescription (org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription)2 ApplicationModule (org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule)2 ApplicationInterfaceDescription (org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription)2 ComputeResourceDescription (org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescription)2 JobManagerCommand (org.apache.airavata.model.appcatalog.computeresource.JobManagerCommand)2 ResourceJobManager (org.apache.airavata.model.appcatalog.computeresource.ResourceJobManager)2 SSHJobSubmission (org.apache.airavata.model.appcatalog.computeresource.SSHJobSubmission)2