Search in sources :

Example 11 with SSHJobSubmission

use of org.apache.airavata.model.appcatalog.computeresource.SSHJobSubmission 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 12 with SSHJobSubmission

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

the class GFacEngineImpl method getResourceJobManager.

public static ResourceJobManager getResourceJobManager(ProcessContext processCtx) throws AppCatalogException, GFacException {
    List<JobSubmissionInterface> jobSubmissionInterfaces = Factory.getDefaultAppCatalog().getComputeResource().getComputeResource(processCtx.getComputeResourceId()).getJobSubmissionInterfaces();
    ResourceJobManager resourceJobManager = null;
    JobSubmissionInterface jsInterface = null;
    for (JobSubmissionInterface jobSubmissionInterface : jobSubmissionInterfaces) {
        if (jobSubmissionInterface.getJobSubmissionProtocol() == processCtx.getJobSubmissionProtocol()) {
            jsInterface = jobSubmissionInterface;
            break;
        }
    }
    if (jsInterface == null) {
        throw new GFacException("Job Submission interface cannot be empty at this point");
    } else if (jsInterface.getJobSubmissionProtocol() == JobSubmissionProtocol.SSH) {
        SSHJobSubmission sshJobSubmission = Factory.getDefaultAppCatalog().getComputeResource().getSSHJobSubmission(jsInterface.getJobSubmissionInterfaceId());
        // fixme - Move this to populate process
        processCtx.setMonitorMode(sshJobSubmission.getMonitorMode());
        // context method.
        resourceJobManager = sshJobSubmission.getResourceJobManager();
    } else if (jsInterface.getJobSubmissionProtocol() == JobSubmissionProtocol.LOCAL) {
        LOCALSubmission localSubmission = Factory.getDefaultAppCatalog().getComputeResource().getLocalJobSubmission(jsInterface.getJobSubmissionInterfaceId());
        resourceJobManager = localSubmission.getResourceJobManager();
    } else if (jsInterface.getJobSubmissionProtocol() == JobSubmissionProtocol.SSH_FORK) {
        SSHJobSubmission sshJobSubmission = Factory.getDefaultAppCatalog().getComputeResource().getSSHJobSubmission(jsInterface.getJobSubmissionInterfaceId());
        // fixme - Move this to populate process
        processCtx.setMonitorMode(sshJobSubmission.getMonitorMode());
        resourceJobManager = sshJobSubmission.getResourceJobManager();
    } else if (jsInterface.getJobSubmissionProtocol() == JobSubmissionProtocol.CLOUD) {
        return null;
    } else {
        throw new GFacException("Unsupported JobSubmissionProtocol - " + jsInterface.getJobSubmissionProtocol().name());
    }
    if (resourceJobManager == null) {
        throw new GFacException("Resource Job Manager is empty.");
    }
    return resourceJobManager;
}
Also used : LOCALSubmission(org.apache.airavata.model.appcatalog.computeresource.LOCALSubmission) JobSubmissionInterface(org.apache.airavata.model.appcatalog.computeresource.JobSubmissionInterface) GFacException(org.apache.airavata.gfac.core.GFacException) ResourceJobManager(org.apache.airavata.model.appcatalog.computeresource.ResourceJobManager) SSHJobSubmission(org.apache.airavata.model.appcatalog.computeresource.SSHJobSubmission)

Aggregations

SSHJobSubmission (org.apache.airavata.model.appcatalog.computeresource.SSHJobSubmission)12 ComputeResourceDescription (org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescription)11 ResourceJobManager (org.apache.airavata.model.appcatalog.computeresource.ResourceJobManager)11 ApplicationDeploymentDescription (org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription)10 ApplicationModule (org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule)10 ApplicationInterfaceDescription (org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription)10 JobManagerCommand (org.apache.airavata.model.appcatalog.computeresource.JobManagerCommand)2 JobSubmissionInterface (org.apache.airavata.model.appcatalog.computeresource.JobSubmissionInterface)2 ApplicationSettingsException (org.apache.airavata.common.exception.ApplicationSettingsException)1 CredentialStoreException (org.apache.airavata.credential.store.exception.CredentialStoreException)1 GFacException (org.apache.airavata.gfac.core.GFacException)1 LOCALSubmission (org.apache.airavata.model.appcatalog.computeresource.LOCALSubmission)1 ComputeResourcePreference (org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference)1 UserComputeResourcePreference (org.apache.airavata.model.appcatalog.userresourceprofile.UserComputeResourcePreference)1 RegistryService (org.apache.airavata.registry.api.RegistryService)1 RegistryServiceException (org.apache.airavata.registry.api.exception.RegistryServiceException)1 TException (org.apache.thrift.TException)1