Search in sources :

Example 81 with OutputDataObjectType

use of org.apache.airavata.model.application.io.OutputDataObjectType in project airavata by apache.

the class RegisterSampleApplications method registerUltrascanInterface.

private void registerUltrascanInterface() {
    try {
        System.out.println("#### Registering Ultrascan Application Interface ####");
        List<String> appModules = new ArrayList<String>();
        appModules.add(ultrascanModuleId);
        InputDataObjectType input1 = RegisterSampleApplicationsUtils.createAppInput("input", null, DataType.URI, null, 1, true, true, false, "input file", null);
        List<InputDataObjectType> applicationInputs = new ArrayList<InputDataObjectType>();
        applicationInputs.add(input1);
        OutputDataObjectType output1 = RegisterSampleApplicationsUtils.createAppOutput("output/analysis-results.tar", "", DataType.URI, true, true, null);
        OutputDataObjectType output2 = RegisterSampleApplicationsUtils.createAppOutput("STDOUT", "", DataType.STDOUT, true, true, null);
        OutputDataObjectType output3 = RegisterSampleApplicationsUtils.createAppOutput("STDERR", "", DataType.STDERR, true, true, null);
        List<OutputDataObjectType> applicationOutputs = new ArrayList<OutputDataObjectType>();
        applicationOutputs.add(output1);
        applicationOutputs.add(output2);
        applicationOutputs.add(output3);
        String ultrascanInterfaceId = airavataClient.registerApplicationInterface(new AuthzToken(""), DEFAULT_GATEWAY, RegisterSampleApplicationsUtils.createApplicationInterfaceDescription("Ultrascan", "Ultrascan application", appModules, applicationInputs, applicationOutputs));
        System.out.println("Ultrascan Application Interface Id " + ultrascanInterfaceId);
    } catch (TException e) {
        e.printStackTrace();
    }
}
Also used : TException(org.apache.thrift.TException) OutputDataObjectType(org.apache.airavata.model.application.io.OutputDataObjectType) InputDataObjectType(org.apache.airavata.model.application.io.InputDataObjectType) AuthzToken(org.apache.airavata.model.security.AuthzToken)

Example 82 with OutputDataObjectType

use of org.apache.airavata.model.application.io.OutputDataObjectType in project airavata by apache.

the class RegisterUS3Application method registerUltrascanInterface.

public static void registerUltrascanInterface() {
    try {
        System.out.println("#### Registering WRF Interface #### \n");
        List<String> appModules = new ArrayList<String>();
        appModules.add(ultrascanModuleId);
        InputDataObjectType input1 = RegisterSampleApplicationsUtils.createAppInput("input", null, DataType.URI, null, 1, true, true, false, "input tar file", null);
        List<InputDataObjectType> applicationInputs = new ArrayList<InputDataObjectType>();
        applicationInputs.add(input1);
        OutputDataObjectType output1 = RegisterSampleApplicationsUtils.createAppOutput("output", "", DataType.URI, true, false, null);
        // OutputDataObjectType output2 = RegisterSampleApplicationsUtils.createAppOutput("stdout",
        // "", DataType.URI);
        // OutputDataObjectType output3 = RegisterSampleApplicationsUtils.createAppOutput("stderr",
        // "", DataType.URI);
        List<OutputDataObjectType> applicationOutputs = new ArrayList<OutputDataObjectType>();
        applicationOutputs.add(output1);
        ultrascanAppId = airavataClient.registerApplicationInterface(new AuthzToken(""), DEFAULT_GATEWAY, RegisterSampleApplicationsUtils.createApplicationInterfaceDescription("ultrascan", "ultrascan application", appModules, applicationInputs, applicationOutputs));
        System.out.println("Ultrascan Application Interface Id " + ultrascanAppId);
    } catch (TException e) {
        e.printStackTrace();
    }
}
Also used : TException(org.apache.thrift.TException) OutputDataObjectType(org.apache.airavata.model.application.io.OutputDataObjectType) InputDataObjectType(org.apache.airavata.model.application.io.InputDataObjectType) ArrayList(java.util.ArrayList) AuthzToken(org.apache.airavata.model.security.AuthzToken)

Example 83 with OutputDataObjectType

use of org.apache.airavata.model.application.io.OutputDataObjectType in project airavata by apache.

the class RegisterSampleApplicationsUtils method createAppOutput.

public static OutputDataObjectType createAppOutput(String inputName, String value, DataType type, boolean isRequired, boolean requiredToCMD, String argument) {
    OutputDataObjectType outputDataObjectType = new OutputDataObjectType();
    if (inputName != null)
        outputDataObjectType.setName(inputName);
    if (value != null)
        outputDataObjectType.setValue(value);
    if (type != null)
        outputDataObjectType.setType(type);
    outputDataObjectType.setIsRequired(isRequired);
    outputDataObjectType.setRequiredToAddedToCommandLine(requiredToCMD);
    outputDataObjectType.setApplicationArgument(argument);
    return outputDataObjectType;
}
Also used : OutputDataObjectType(org.apache.airavata.model.application.io.OutputDataObjectType)

Example 84 with OutputDataObjectType

use of org.apache.airavata.model.application.io.OutputDataObjectType in project airavata by apache.

the class InputNodeImpl method convert.

private OutputDataObjectType convert(InputDataObjectType inputObject) {
    OutputDataObjectType output = new OutputDataObjectType(inputObject.getName());
    output.setType(inputObject.getType());
    output.setValue(inputObject.getValue());
    output.setIsRequired(inputObject.isIsRequired());
    output.setApplicationArgument(inputObject.getApplicationArgument());
    output.setOutputStreaming(false);
    // output.setDataMovement(true);
    return output;
}
Also used : OutputDataObjectType(org.apache.airavata.model.application.io.OutputDataObjectType)

Example 85 with OutputDataObjectType

use of org.apache.airavata.model.application.io.OutputDataObjectType in project airavata by apache.

the class GFacEngineImpl method populateProcessContext.

@Override
public ProcessContext populateProcessContext(String processId, String gatewayId, String tokenId) throws GFacException, CredentialStoreException {
    // NOTE: Process context gives precedence to data come with process Computer resources;
    ProcessContext processContext = null;
    ProcessContext.ProcessContextBuilder builder = new ProcessContext.ProcessContextBuilder(processId, gatewayId, tokenId);
    try {
        AppCatalog appCatalog = Factory.getDefaultAppCatalog();
        ExperimentCatalog expCatalog = Factory.getDefaultExpCatalog();
        ProcessModel processModel = (ProcessModel) expCatalog.get(ExperimentCatalogModelType.PROCESS, processId);
        builder.setAppCatalog(appCatalog).setExperimentCatalog(expCatalog).setCuratorClient(Factory.getCuratorClient()).setStatusPublisher(Factory.getStatusPublisher()).setProcessModel(processModel).setGatewayResourceProfile(appCatalog.getGatewayProfile().getGatewayProfile(gatewayId)).setGatewayComputeResourcePreference(appCatalog.getGatewayProfile().getComputeResourcePreference(gatewayId, processModel.getComputeResourceId())).setGatewayStorageResourcePreference(appCatalog.getGatewayProfile().getStoragePreference(gatewayId, processModel.getStorageResourceId()));
        processContext = builder.build();
        /* check point */
        checkpoint(processContext);
        if (processModel.isUseUserCRPref()) {
            setUserResourceProfile(gatewayId, processContext);
            setUserComputeResourcePreference(gatewayId, processContext);
        }
        String scratchLocation = processContext.getScratchLocation();
        String workingDirectory = scratchLocation + File.separator + processId + File.separator;
        StorageResourceDescription storageResource = appCatalog.getStorageResource().getStorageResource(processModel.getStorageResourceId());
        if (storageResource != null) {
            processContext.setStorageResource(storageResource);
        } else {
            // we need to fail the process which will fail the experiment
            processContext.setProcessStatus(new ProcessStatus(ProcessState.FAILED));
            GFacUtils.saveAndPublishProcessStatus(processContext);
            throw new GFacException("expId: " + processModel.getExperimentId() + ", processId: " + processId + ":- Couldn't find storage resource for storage resource id :" + processModel.getStorageResourceId());
        }
        /*            StorageResourceDescription storageResource = appCatalog.getStorageResource().getStorageResource(processModel.getStorageResourceId());
            if (storageResource != null){
                processContext.setStorageResource(storageResource);
            }*/
        processContext.setComputeResourceDescription(appCatalog.getComputeResource().getComputeResource(processContext.getComputeResourceId()));
        processContext.setApplicationDeploymentDescription(appCatalog.getApplicationDeployment().getApplicationDeployement(processModel.getApplicationDeploymentId()));
        ApplicationInterfaceDescription applicationInterface = appCatalog.getApplicationInterface().getApplicationInterface(processModel.getApplicationInterfaceId());
        processContext.setApplicationInterfaceDescription(applicationInterface);
        List<OutputDataObjectType> applicationOutputs = applicationInterface.getApplicationOutputs();
        if (applicationOutputs != null && !applicationOutputs.isEmpty()) {
            for (OutputDataObjectType outputDataObjectType : applicationOutputs) {
                if (outputDataObjectType.getType().equals(DataType.STDOUT)) {
                    if (outputDataObjectType.getValue() == null || outputDataObjectType.getValue().equals("")) {
                        outputDataObjectType.setValue(workingDirectory + applicationInterface.getApplicationName() + ".stdout");
                        processContext.setStdoutLocation(workingDirectory + applicationInterface.getApplicationName() + ".stdout");
                    } else {
                        processContext.setStdoutLocation(outputDataObjectType.getValue());
                    }
                }
                if (outputDataObjectType.getType().equals(DataType.STDERR)) {
                    if (outputDataObjectType.getValue() == null || outputDataObjectType.getValue().equals("")) {
                        String stderrLocation = workingDirectory + applicationInterface.getApplicationName() + ".stderr";
                        outputDataObjectType.setValue(stderrLocation);
                        processContext.setStderrLocation(stderrLocation);
                    } else {
                        processContext.setStderrLocation(outputDataObjectType.getValue());
                    }
                }
            }
        }
        expCatalog.update(ExperimentCatalogModelType.PROCESS, processModel, processId);
        processModel.setProcessOutputs(applicationOutputs);
        if (processContext.getJobSubmissionProtocol() == JobSubmissionProtocol.UNICORE) {
            // process monitor mode set in getResourceJobManager method, but unicore doesn't have resource job manager.
            // hence we set process monitor mode here.
            processContext.setMonitorMode(MonitorMode.FORK);
        } else {
            processContext.setResourceJobManager(getResourceJobManager(processContext));
            processContext.setJobSubmissionRemoteCluster(Factory.getJobSubmissionRemoteCluster(processContext));
            processContext.setDataMovementRemoteCluster(Factory.getDataMovementRemoteCluster(processContext));
        }
        String inputPath = ServerSettings.getLocalDataLocation();
        if (inputPath != null) {
            processContext.setLocalWorkingDir((inputPath.endsWith("/") ? inputPath : inputPath + "/") + processContext.getProcessId());
        }
        List<Object> jobModels = expCatalog.get(ExperimentCatalogModelType.JOB, "processId", processId);
        if (jobModels != null && !jobModels.isEmpty()) {
            if (jobModels.size() > 1) {
                log.warn("Process has more than one job model, take first one");
            }
            processContext.setJobModel(((JobModel) jobModels.get(0)));
        }
        return processContext;
    } catch (AppCatalogException e) {
        String msg = "App catalog access exception ";
        saveErrorModel(processContext, e, msg);
        updateProcessFailure(processContext, msg);
        throw new GFacException(msg, e);
    } catch (RegistryException e) {
        String msg = "Registry access exception";
        saveErrorModel(processContext, e, msg);
        updateProcessFailure(processContext, msg);
        throw new GFacException(msg, e);
    } catch (AiravataException e) {
        String msg = "Remote cluster initialization error";
        saveErrorModel(processContext, e, msg);
        updateProcessFailure(processContext, msg);
        throw new GFacException(msg, e);
    }
}
Also used : ProcessModel(org.apache.airavata.model.process.ProcessModel) ExperimentCatalog(org.apache.airavata.registry.cpi.ExperimentCatalog) ProcessStatus(org.apache.airavata.model.status.ProcessStatus) AppCatalog(org.apache.airavata.registry.cpi.AppCatalog) RegistryException(org.apache.airavata.registry.cpi.RegistryException) ProcessContext(org.apache.airavata.gfac.core.context.ProcessContext) AppCatalogException(org.apache.airavata.registry.cpi.AppCatalogException) StorageResourceDescription(org.apache.airavata.model.appcatalog.storageresource.StorageResourceDescription) GFacException(org.apache.airavata.gfac.core.GFacException) OutputDataObjectType(org.apache.airavata.model.application.io.OutputDataObjectType) ApplicationInterfaceDescription(org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription) JobModel(org.apache.airavata.model.job.JobModel) AiravataException(org.apache.airavata.common.exception.AiravataException)

Aggregations

OutputDataObjectType (org.apache.airavata.model.application.io.OutputDataObjectType)93 InputDataObjectType (org.apache.airavata.model.application.io.InputDataObjectType)60 TException (org.apache.thrift.TException)51 AuthzToken (org.apache.airavata.model.security.AuthzToken)44 ComputationalResourceSchedulingModel (org.apache.airavata.model.scheduling.ComputationalResourceSchedulingModel)34 ExperimentModel (org.apache.airavata.model.experiment.ExperimentModel)33 UserConfigurationDataModel (org.apache.airavata.model.experiment.UserConfigurationDataModel)33 ArrayList (java.util.ArrayList)18 Project (org.apache.airavata.model.workspace.Project)16 RegistryException (org.apache.airavata.registry.cpi.RegistryException)14 GFacException (org.apache.airavata.gfac.core.GFacException)7 AiravataClientException (org.apache.airavata.model.error.AiravataClientException)7 AiravataSystemException (org.apache.airavata.model.error.AiravataSystemException)7 InvalidRequestException (org.apache.airavata.model.error.InvalidRequestException)7 URISyntaxException (java.net.URISyntaxException)6 AiravataException (org.apache.airavata.common.exception.AiravataException)5 HashMap (java.util.HashMap)4 ApplicationSettingsException (org.apache.airavata.common.exception.ApplicationSettingsException)4 ProcessContext (org.apache.airavata.gfac.core.context.ProcessContext)4 JobStatus (org.apache.airavata.model.status.JobStatus)4