Search in sources :

Example 31 with AuthzToken

use of org.apache.airavata.model.security.AuthzToken in project airavata by apache.

the class CreateLaunchExperiment method createGateway.

public static void createGateway() {
    try {
        Gateway gateway = new Gateway();
        gateway.setGatewayId("testGatewayId2");
        gateway.setGatewayName("testGateway2");
        gatewayId = airavataClient.addGateway(new AuthzToken(""), gateway);
        System.out.println(gatewayId);
    } catch (AiravataSystemException e) {
        e.printStackTrace();
    } catch (InvalidRequestException e) {
        e.printStackTrace();
    } catch (AiravataClientException e) {
        e.printStackTrace();
    } catch (TException e) {
        e.printStackTrace();
    }
}
Also used : TException(org.apache.thrift.TException) Gateway(org.apache.airavata.model.workspace.Gateway) AuthzToken(org.apache.airavata.model.security.AuthzToken)

Example 32 with AuthzToken

use of org.apache.airavata.model.security.AuthzToken in project airavata by apache.

the class CreateLaunchExperiment method createAndLaunchExp.

public static void createAndLaunchExp() throws TException {
    List<String> experimentIds = new ArrayList<String>();
    try {
        for (int i = 0; i < 1; i++) {
            // final String expId = createExperimentForSSHHost(airavata);
            // final String expId = createEchoExperimentForFSD(airavataClient);
            // final String expId = createMPIExperimentForFSD(airavataClient);
            // final String expId = createEchoExperimentForStampede(airavataClient);
            // final String expId = createEchoExperimentForTrestles(airavataClient);
            // final String expId = createExperimentEchoForLocalHost(airavataClient);
            // final String expId = createExperimentWRFTrestles(airavataClient);
            // final String expId = createExperimentForBR2(airavataClient);
            // final String expId = createExperimentForBR2Amber(airavataClient);
            // final String expId = createExperimentWRFStampede(airavataClient);
            final String expId = createExperimentForStampedeAmber(airavataClient);
            // String expId = createExperimentForTrestlesAmber(airavataClient);
            // final String expId = createExperimentGROMACSStampede(airavataClient);
            // final String expId = createExperimentESPRESSOStampede(airavataClient);
            // final String expId = createExperimentLAMMPSStampede(airavataClient);
            // final String expId = createExperimentNWCHEMStampede(airavataClient);
            // final String expId = createExperimentTRINITYStampede(airavataClient);
            // final String expId = createExperimentAUTODOCKStampede(airavataClient); // this is not working , we need to register AutoDock app on stampede
            // final String expId = createExperimentForLSF(airavataClient);
            // final String expId = createExperimentLAMMPSForLSF(airavataClient);
            // final String expId = "Ultrascan_ln_eb029947-391a-4ccf-8ace-9bafebe07cc0";
            experimentIds.add(expId);
            System.out.println("Experiment ID : " + expId);
            // updateExperiment(airavata, expId);
            launchExperiment(airavataClient, expId);
        }
        boolean allNotFinished = true;
        while (allNotFinished) {
            allNotFinished = false;
            for (String exId : experimentIds) {
                ExperimentModel experiment = airavataClient.getExperiment(new AuthzToken(""), exId);
                if (!experiment.getExperimentStatus().get(0).getState().equals(ExperimentState.COMPLETED) && !experiment.getExperimentStatus().get(0).getState().equals(ExperimentState.FAILED) && !experiment.getExperimentStatus().get(0).getState().equals(ExperimentState.CANCELED)) {
                    allNotFinished = true;
                }
                System.out.println(experiment.getExperimentId() + " " + experiment.getExperimentStatus().get(0).getState().name());
            }
            System.out.println("----------------------------------------------------");
            Thread.sleep(10000);
        }
    } catch (Exception e) {
        logger.error("Error while connecting with server", e.getMessage());
        e.printStackTrace();
    }
}
Also used : ArrayList(java.util.ArrayList) ExperimentModel(org.apache.airavata.model.experiment.ExperimentModel) AuthzToken(org.apache.airavata.model.security.AuthzToken) TException(org.apache.thrift.TException)

Example 33 with AuthzToken

use of org.apache.airavata.model.security.AuthzToken in project airavata by apache.

the class CreateLaunchExperiment method getAvailableAppInterfaceComputeResources.

public static void getAvailableAppInterfaceComputeResources(String appInterfaceId) {
    try {
        Map<String, String> availableAppInterfaceComputeResources = airavataClient.getAvailableAppInterfaceComputeResources(new AuthzToken(""), appInterfaceId);
        for (String key : availableAppInterfaceComputeResources.keySet()) {
            System.out.println("id : " + key);
            System.out.println("name : " + availableAppInterfaceComputeResources.get(key));
        }
    } catch (AiravataSystemException e) {
        e.printStackTrace();
    } catch (InvalidRequestException e) {
        e.printStackTrace();
    } catch (AiravataClientException e) {
        e.printStackTrace();
    } catch (TException e) {
        e.printStackTrace();
    }
}
Also used : TException(org.apache.thrift.TException) AuthzToken(org.apache.airavata.model.security.AuthzToken)

Example 34 with AuthzToken

use of org.apache.airavata.model.security.AuthzToken in project airavata by apache.

the class CreateLaunchExperiment method createExperimentWRFTrestles.

public static String createExperimentWRFTrestles(Airavata.Client client) throws TException {
    try {
        List<InputDataObjectType> exInputs = client.getApplicationInputs(new AuthzToken(""), wrfAppId);
        setWRFInputs(exInputs);
        List<OutputDataObjectType> exOut = client.getApplicationOutputs(new AuthzToken(""), wrfAppId);
        ExperimentModel simpleExperiment = ExperimentModelUtil.createSimpleExperiment(DEFAULT_GATEWAY, "default", "admin", "WRFExperiment", "Testing", wrfAppId, exInputs);
        simpleExperiment.setExperimentOutputs(exOut);
        Map<String, String> computeResources = airavataClient.getAvailableAppInterfaceComputeResources(new AuthzToken(""), wrfAppId);
        if (computeResources != null && computeResources.size() != 0) {
            for (String id : computeResources.keySet()) {
                String resourceName = computeResources.get(id);
                if (resourceName.equals(trestlesHostName)) {
                    ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 1, 1, 1, "normal", 30, 1);
                    UserConfigurationDataModel userConfigurationData = new UserConfigurationDataModel();
                    userConfigurationData.setAiravataAutoSchedule(false);
                    userConfigurationData.setOverrideManualScheduledParams(false);
                    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);
    }
    return null;
}
Also used : TException(org.apache.thrift.TException) InputDataObjectType(org.apache.airavata.model.application.io.InputDataObjectType) ExperimentModel(org.apache.airavata.model.experiment.ExperimentModel) OutputDataObjectType(org.apache.airavata.model.application.io.OutputDataObjectType) UserConfigurationDataModel(org.apache.airavata.model.experiment.UserConfigurationDataModel) AuthzToken(org.apache.airavata.model.security.AuthzToken) ComputationalResourceSchedulingModel(org.apache.airavata.model.scheduling.ComputationalResourceSchedulingModel)

Example 35 with AuthzToken

use of org.apache.airavata.model.security.AuthzToken in project airavata by apache.

the class RegisterSampleApplications method registerEspressoInterface.

public void registerEspressoInterface() {
    try {
        System.out.println("#### Registering Espresso Interface #### \n");
        List<String> appModules = new ArrayList<String>();
        appModules.add(espressoModuleId);
        InputDataObjectType input1 = RegisterSampleApplicationsUtils.createAppInput("AI_Primitive_Cell", null, DataType.URI, null, 1, true, true, false, "AI_Metal_Input_File - Al.sample.in", null);
        InputDataObjectType input2 = RegisterSampleApplicationsUtils.createAppInput("AI_Pseudopotential_File", null, DataType.URI, null, 2, true, true, false, "Constant pressure and temperature for production stage - Al.pz-vbc.UPF", null);
        List<InputDataObjectType> applicationInputs = new ArrayList<InputDataObjectType>();
        applicationInputs.add(input1);
        applicationInputs.add(input2);
        OutputDataObjectType output1 = RegisterSampleApplicationsUtils.createAppOutput("ESPRESSO_Execution_Log", null, DataType.URI, true, true, null);
        OutputDataObjectType output2 = RegisterSampleApplicationsUtils.createAppOutput("ESPRESSO_WFC_Binary_file", null, DataType.URI, true, true, null);
        OutputDataObjectType output3 = RegisterSampleApplicationsUtils.createAppOutput("STDOUT", null, DataType.STDOUT, true, true, null);
        OutputDataObjectType output4 = RegisterSampleApplicationsUtils.createAppOutput("STDERR", null, DataType.STDERR, true, true, null);
        List<OutputDataObjectType> applicationOutputs = new ArrayList<OutputDataObjectType>();
        applicationOutputs.add(output1);
        applicationOutputs.add(output2);
        applicationOutputs.add(output3);
        applicationOutputs.add(output4);
        espressoInterfaceId = airavataClient.registerApplicationInterface(new AuthzToken(""), DEFAULT_GATEWAY, RegisterSampleApplicationsUtils.createApplicationInterfaceDescription(espressoName, espressoDescription, appModules, applicationInputs, applicationOutputs));
        System.out.println("Espresso Application Interface Id " + espressoInterfaceId);
    } 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)

Aggregations

AuthzToken (org.apache.airavata.model.security.AuthzToken)92 TException (org.apache.thrift.TException)71 InputDataObjectType (org.apache.airavata.model.application.io.InputDataObjectType)46 OutputDataObjectType (org.apache.airavata.model.application.io.OutputDataObjectType)44 ExperimentModel (org.apache.airavata.model.experiment.ExperimentModel)33 UserConfigurationDataModel (org.apache.airavata.model.experiment.UserConfigurationDataModel)28 ComputationalResourceSchedulingModel (org.apache.airavata.model.scheduling.ComputationalResourceSchedulingModel)28 AiravataClientException (org.apache.airavata.model.error.AiravataClientException)15 Project (org.apache.airavata.model.workspace.Project)13 ArrayList (java.util.ArrayList)12 InvalidRequestException (org.apache.airavata.model.error.InvalidRequestException)8 HashMap (java.util.HashMap)7 AiravataSystemException (org.apache.airavata.model.error.AiravataSystemException)7 Gateway (org.apache.airavata.model.workspace.Gateway)6 CommandObject (org.apache.airavata.model.appcatalog.appdeployment.CommandObject)5 SCPDataMovement (org.apache.airavata.model.data.movement.SCPDataMovement)5 ComputeResourcePreference (org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference)4 GatewayResourceProfile (org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile)4 ComputeResourceDescription (org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescription)2 JobSubmissionInterface (org.apache.airavata.model.appcatalog.computeresource.JobSubmissionInterface)2