Search in sources :

Example 1 with AiravataClientException

use of org.apache.airavata.model.error.AiravataClientException in project airavata by apache.

the class AiravataClient method getAiravataClient.

public Airavata.Client getAiravataClient() throws Exception {
    try {
        String airavataHost = propertyReader.readProperty(TestFrameworkConstants.AiravataClientConstants.THRIFT_SERVER_HOST, PropertyFileType.AIRAVATA_SERVER);
        int airavataport = Integer.valueOf(propertyReader.readProperty(TestFrameworkConstants.AiravataClientConstants.THRIFT_SERVER_PORT, PropertyFileType.AIRAVATA_SERVER));
        airavataClient = AiravataClientFactory.createAiravataClient(airavataHost, airavataport);
        return airavataClient;
    } catch (AiravataClientException e) {
        logger.error("Error while creating airavata client instance", e);
        throw new Exception("Error while creating airavata client instance", e);
    }
}
Also used : AiravataClientException(org.apache.airavata.model.error.AiravataClientException) AiravataClientException(org.apache.airavata.model.error.AiravataClientException)

Example 2 with AiravataClientException

use of org.apache.airavata.model.error.AiravataClientException in project airavata by apache.

the class ComputeResourceRegister method registerComputeHost.

public ComputeResourceProperties registerComputeHost(String hostName, String hostDesc, ResourceJobManagerType resourceJobManagerType, String monitoringEndPoint, String jobMangerBinPath, SecurityProtocol securityProtocol, String jobManagerCommand) throws TException {
    ComputeResourceDescription computeResourceDescription = createComputeResourceDescription(hostName, hostDesc, null, null);
    ComputeResourceProperties computeResourceProperties = new ComputeResourceProperties();
    String computeResourceId = airavata.registerComputeResource(authzToken, computeResourceDescription);
    computeResourceProperties.setComputeResourceId(computeResourceId);
    if (computeResourceId.isEmpty())
        throw new AiravataClientException();
    ResourceJobManager resourceJobManager = createResourceJobManager(resourceJobManagerType, monitoringEndPoint, jobMangerBinPath, null);
    if (jobManagerCommand != null) {
        Map<JobManagerCommand, String> jobManagerCommandStringMap = new HashMap<JobManagerCommand, String>();
        jobManagerCommandStringMap.put(JobManagerCommand.SUBMISSION, jobManagerCommand);
        resourceJobManager.setJobManagerCommands(jobManagerCommandStringMap);
    }
    LOCALSubmission localobSubmission = new LOCALSubmission();
    localobSubmission.setResourceJobManager(resourceJobManager);
    localobSubmission.setSecurityProtocol(securityProtocol);
    String localJobSubmissionId = airavata.addLocalSubmissionDetails(authzToken, computeResourceId, 0, localobSubmission);
    computeResourceProperties.setJobSubmissionId(localJobSubmissionId);
    airavata.addLocalDataMovementDetails(authzToken, computeResourceId, DMType.COMPUTE_RESOURCE, 0, new LOCALDataMovement());
    return computeResourceProperties;
}
Also used : HashMap(java.util.HashMap) LOCALDataMovement(org.apache.airavata.model.data.movement.LOCALDataMovement) ComputeResourceProperties(org.apache.airavata.testsuite.multitenantedairavata.utils.ComputeResourceProperties) AiravataClientException(org.apache.airavata.model.error.AiravataClientException)

Example 3 with AiravataClientException

use of org.apache.airavata.model.error.AiravataClientException in project airavata by apache.

the class ExperimentExecution method getApplicationMap.

protected Map<String, Map<String, String>> getApplicationMap(Map<String, String> tokenMap) throws Exception {
    appInterfaceMap = new HashMap<String, Map<String, String>>();
    try {
        if (tokenMap != null && !tokenMap.isEmpty()) {
            for (String gatewayId : tokenMap.keySet()) {
                Map<String, String> allApplicationInterfaceNames = airavata.getAllApplicationInterfaceNames(authzToken, gatewayId);
                appInterfaceMap.put(gatewayId, allApplicationInterfaceNames);
            }
        }
    } catch (AiravataSystemException e) {
        logger.error("Error while getting application interfaces", e);
        throw new Exception("Error while getting application interfaces", e);
    } catch (InvalidRequestException e) {
        logger.error("Error while getting application interfaces", e);
        throw new Exception("Error while getting application interfaces", e);
    } catch (AiravataClientException e) {
        logger.error("Error while getting application interfaces", e);
        throw new Exception("Error while getting application interfaces", e);
    } catch (TException e) {
        logger.error("Error while getting application interfaces", e);
        throw new Exception("Error while getting application interfaces", e);
    }
    return appInterfaceMap;
}
Also used : TException(org.apache.thrift.TException) AiravataSystemException(org.apache.airavata.model.error.AiravataSystemException) InvalidRequestException(org.apache.airavata.model.error.InvalidRequestException) AiravataClientException(org.apache.airavata.model.error.AiravataClientException) InvalidRequestException(org.apache.airavata.model.error.InvalidRequestException) TException(org.apache.thrift.TException) AiravataClientException(org.apache.airavata.model.error.AiravataClientException) AiravataSystemException(org.apache.airavata.model.error.AiravataSystemException)

Example 4 with AiravataClientException

use of org.apache.airavata.model.error.AiravataClientException in project airavata by apache.

the class GatewayRegister method createGateway.

public void createGateway() throws Exception {
    try {
        // read gateway count from properties file
        List<GatewayResourceProfile> gateReourceProfiles = airavata.getAllGatewayResourceProfiles(authzToken);
        for (GatewayResourceProfile gatewayResourceProfile : gateReourceProfiles) {
            if (gatewayResourceProfile.getGatewayID().equals(properties.getGname())) {
                createProject(gatewayResourceProfile.getGatewayID());
                return;
            }
        }
        String genericGatewayName = properties.getGname();
        String genericGatewayDomain = properties.getGdomain();
        Gateway gateway = new Gateway();
        String gatewayId = genericGatewayName;
        gateway.setGatewayId(gatewayId);
        gateway.setGatewayName(gatewayId);
        gateway.setDomain(gatewayId + genericGatewayDomain);
        gateway.setGatewayApprovalStatus(GatewayApprovalStatus.APPROVED);
        airavata.addGateway(authzToken, gateway);
        String token = airavata.generateAndRegisterSSHKeys(authzToken, gatewayId, testUser, testUser, CredentialOwnerType.USER);
        GatewayResourceProfile gatewayResourceProfile = new GatewayResourceProfile();
        gatewayResourceProfile.setCredentialStoreToken(token);
        gatewayResourceProfile.setGatewayID(gatewayId);
        airavata.registerGatewayResourceProfile(authzToken, gatewayResourceProfile);
        createProject(gatewayId);
    } catch (AiravataSystemException e) {
        logger.error("Error while creating airavata client instance", e);
        throw new Exception("Error while creating airavata client instance", e);
    } catch (InvalidRequestException e) {
        logger.error("Invalid request for airavata client instance", e);
        throw new Exception("Invalid request for airavata client instance", e);
    } catch (AiravataClientException e) {
        logger.error("Error while creating airavata client instance", e);
        throw new Exception("Error while creating airavata client instance", e);
    } catch (TException e) {
        logger.error("Error while communicating with airavata client ", e);
        throw new Exception("Error while communicating with airavata client", e);
    }
}
Also used : TException(org.apache.thrift.TException) AiravataSystemException(org.apache.airavata.model.error.AiravataSystemException) GatewayResourceProfile(org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile) Gateway(org.apache.airavata.model.workspace.Gateway) InvalidRequestException(org.apache.airavata.model.error.InvalidRequestException) AiravataClientException(org.apache.airavata.model.error.AiravataClientException) InvalidRequestException(org.apache.airavata.model.error.InvalidRequestException) CredentialStoreException(org.apache.airavata.credential.store.store.CredentialStoreException) TException(org.apache.thrift.TException) AiravataClientException(org.apache.airavata.model.error.AiravataClientException) ApplicationSettingsException(org.apache.airavata.common.exception.ApplicationSettingsException) AiravataSystemException(org.apache.airavata.model.error.AiravataSystemException)

Example 5 with AiravataClientException

use of org.apache.airavata.model.error.AiravataClientException in project airavata by apache.

the class CreateLaunchExperimentUS3 method createUS3ExperimentForTrestles.

public static String createUS3ExperimentForTrestles(Airavata.Client client) throws AiravataSystemException, InvalidRequestException, AiravataClientException, TException {
    try {
        List<InputDataObjectType> exInputs = new ArrayList<InputDataObjectType>();
        InputDataObjectType input = new InputDataObjectType();
        input.setName("input");
        input.setType(DataType.URI);
        input.setValue("file:///home/sgg/chathuri/laptop_backup/airavata/ultrascan_input/hpcinput.tar");
        InputDataObjectType input1 = new InputDataObjectType();
        input1.setName("walltime");
        input1.setType(DataType.STRING);
        input1.setValue("-walltime=60");
        InputDataObjectType input2 = new InputDataObjectType();
        input2.setName("mgroupcount");
        input2.setType(DataType.STRING);
        input2.setValue("-mgroupcount=1");
        exInputs.add(input);
        exInputs.add(input1);
        exInputs.add(input2);
        List<OutputDataObjectType> exOut = new ArrayList<OutputDataObjectType>();
        OutputDataObjectType output = new OutputDataObjectType();
        output.setName("output");
        output.setType(DataType.URI);
        output.setValue("");
        // OutputDataObjectType output1 = new OutputDataObjectType();
        // output1.setName("stdout");
        // output1.setType(DataType.STDOUT);
        // output1.setValue("");
        // OutputDataObjectType output2 = new OutputDataObjectType();
        // output2.setName("stderr");
        // output2.setType(DataType.STDERR);
        // output2.setValue("");
        exOut.add(output);
        // exOut.add(output1);
        // exOut.add(output2);
        Project project = ProjectModelUtil.createProject("ultrascan", "ultrascan", "test project");
        String projectId = client.createProject(new AuthzToken(""), DEFAULT_GATEWAY, project);
        ExperimentModel simpleExperiment = ExperimentModelUtil.createSimpleExperiment(DEFAULT_GATEWAY, projectId, "ultrascan", "US3ExperimentTrestles", "US3AppTrestles", "ultrascan_7ce6cd43-622c-44e0-87c5-fb7a6528c799", exInputs);
        simpleExperiment.setExperimentOutputs(exOut);
        ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling("trestles.sdsc.xsede.org_72b9181b-7156-4975-a386-ed98b4949496", 32, 1, 0, "shared", 30, 0);
        UserConfigurationDataModel userConfigurationData = new UserConfigurationDataModel();
        scheduling.setResourceHostId("trestles.sdsc.xsede.org_72b9181b-7156-4975-a386-ed98b4949496");
        userConfigurationData.setAiravataAutoSchedule(false);
        userConfigurationData.setOverrideManualScheduledParams(false);
        /*          AdvancedOutputDataHandling dataHandling = new AdvancedOutputDataHandling();
            dataHandling.setOutputDataDir("/home/sgg/chathuri/laptop_backup/airavata");
            userConfigurationData.setAdvanceOutputDataHandling(dataHandling);*/
        userConfigurationData.setComputationalResourceScheduling(scheduling);
        simpleExperiment.setUserConfigurationData(userConfigurationData);
        return client.createExperiment(new AuthzToken(""), DEFAULT_GATEWAY, simpleExperiment);
    } catch (AiravataSystemException e) {
        logger.error("Error occured while creating the experiment...", e.getMessage());
        throw new AiravataSystemException(e);
    } catch (InvalidRequestException e) {
        logger.error("Error occured while creating the experiment...", e.getMessage());
        throw new InvalidRequestException(e);
    } catch (AiravataClientException e) {
        logger.error("Error occured while creating the experiment...", e.getMessage());
        throw new AiravataClientException(e);
    } catch (TException e) {
        logger.error("Error occured while creating the experiment...", e.getMessage());
        throw new TException(e);
    }
}
Also used : TException(org.apache.thrift.TException) InputDataObjectType(org.apache.airavata.model.application.io.InputDataObjectType) ArrayList(java.util.ArrayList) ExperimentModel(org.apache.airavata.model.experiment.ExperimentModel) Project(org.apache.airavata.model.workspace.Project) AiravataSystemException(org.apache.airavata.model.error.AiravataSystemException) OutputDataObjectType(org.apache.airavata.model.application.io.OutputDataObjectType) UserConfigurationDataModel(org.apache.airavata.model.experiment.UserConfigurationDataModel) AuthzToken(org.apache.airavata.model.security.AuthzToken) InvalidRequestException(org.apache.airavata.model.error.InvalidRequestException) AiravataClientException(org.apache.airavata.model.error.AiravataClientException) ComputationalResourceSchedulingModel(org.apache.airavata.model.scheduling.ComputationalResourceSchedulingModel)

Aggregations

AiravataClientException (org.apache.airavata.model.error.AiravataClientException)26 AiravataSystemException (org.apache.airavata.model.error.AiravataSystemException)15 InvalidRequestException (org.apache.airavata.model.error.InvalidRequestException)15 TException (org.apache.thrift.TException)15 AuthzToken (org.apache.airavata.model.security.AuthzToken)12 HashMap (java.util.HashMap)7 ArrayList (java.util.ArrayList)6 InputDataObjectType (org.apache.airavata.model.application.io.InputDataObjectType)6 OutputDataObjectType (org.apache.airavata.model.application.io.OutputDataObjectType)6 ExperimentModel (org.apache.airavata.model.experiment.ExperimentModel)6 UserConfigurationDataModel (org.apache.airavata.model.experiment.UserConfigurationDataModel)6 ComputationalResourceSchedulingModel (org.apache.airavata.model.scheduling.ComputationalResourceSchedulingModel)6 SCPDataMovement (org.apache.airavata.model.data.movement.SCPDataMovement)5 Project (org.apache.airavata.model.workspace.Project)5 XBayaLabel (org.apache.airavata.xbaya.ui.widgets.XBayaLabel)4 XBayaTextField (org.apache.airavata.xbaya.ui.widgets.XBayaTextField)4 JLabel (javax.swing.JLabel)3 TBinaryProtocol (org.apache.thrift.protocol.TBinaryProtocol)3 TProtocol (org.apache.thrift.protocol.TProtocol)3 TSocket (org.apache.thrift.transport.TSocket)3