Search in sources :

Example 66 with AuthzToken

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

the class RegisterSampleApplications method registerLocalApps.

public void registerLocalApps() {
    try {
        System.out.println("#### Registering Application Deployments on Localhost #### \n");
        // Register Echo
        String echoAppDeployId = airavataClient.registerApplicationDeployment(new AuthzToken(""), DEFAULT_GATEWAY, RegisterSampleApplicationsUtils.createApplicationDeployment(echoModuleId, localhostId, "/bin/echo", ApplicationParallelismType.SERIAL, echoDescription, null, null, null));
        System.out.println("Echo on localhost Id " + echoAppDeployId);
    } catch (TException e) {
        e.printStackTrace();
    }
}
Also used : TException(org.apache.thrift.TException) AuthzToken(org.apache.airavata.model.security.AuthzToken)

Example 67 with AuthzToken

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

the class CreateLaunchBES method createEchoExperimentForFSD.

public static String createEchoExperimentForFSD(Airavata.Client client) throws TException {
    try {
        List<InputDataObjectType> exInputs = client.getApplicationInputs(new AuthzToken(""), echoAppId);
        for (InputDataObjectType inputDataObjectType : exInputs) {
            if (inputDataObjectType.getName().equalsIgnoreCase("Input_to_Echo")) {
                inputDataObjectType.setValue("Hello World");
            } else if (inputDataObjectType.getName().equalsIgnoreCase("Input_to_Echo2")) {
                inputDataObjectType.setValue("http://www.textfiles.com/100/ad.txt");
            } else if (inputDataObjectType.getName().equalsIgnoreCase("Input_to_Echo3")) {
                inputDataObjectType.setValue("file:///tmp/test.txt");
            }
        }
        List<OutputDataObjectType> exOut = client.getApplicationOutputs(new AuthzToken(""), echoAppId);
        ExperimentModel simpleExperiment = ExperimentModelUtil.createSimpleExperiment(DEFAULT_GATEWAY, "default", "admin", "echoExperiment", "SimpleEcho2", echoAppId, exInputs);
        simpleExperiment.setExperimentOutputs(exOut);
        Map<String, String> computeResources = airavataClient.getAvailableAppInterfaceComputeResources(new AuthzToken(""), echoAppId);
        if (computeResources != null && computeResources.size() != 0) {
            for (String id : computeResources.keySet()) {
                String resourceName = computeResources.get(id);
                if (resourceName.equals(unicoreHostName)) {
                    ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 1, 1, 1, "normal", 30, 1048576);
                    UserConfigurationDataModel userConfigurationData = new UserConfigurationDataModel();
                    userConfigurationData.setAiravataAutoSchedule(false);
                    userConfigurationData.setOverrideManualScheduledParams(false);
                    userConfigurationData.setComputationalResourceScheduling(scheduling);
                    userConfigurationData.setGenerateCert(false);
                    userConfigurationData.setUserDN("");
                    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 68 with AuthzToken

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

the class CreateLaunchBES 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 69 with AuthzToken

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

the class CreateLaunchBES 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 = createEchoExperimentForFSD(airavataClient);
            final String expId = createMPIExperimentForFSD(airavataClient);
            experimentIds.add(expId);
            System.out.println("Experiment ID : " + expId);
            // updateExperiment(airavata, expId);
            launchExperiment(airavataClient, expId);
        }
        Thread.sleep(10000);
        for (String exId : experimentIds) {
            ExperimentModel experiment = airavataClient.getExperiment(new AuthzToken(""), exId);
            System.out.println(experiment.getExperimentId() + " " + experiment.getExperimentStatus().get(0).getState().name());
        }
    } 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 70 with AuthzToken

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

the class CreateLaunchBES method getGateway.

public static void getGateway(String gatewayId) {
    try {
        Gateway gateway = airavataClient.getGateway(new AuthzToken(""), gatewayId);
        gateway.setDomain("testDomain");
        airavataClient.updateGateway(new AuthzToken(""), gatewayId, gateway);
        List<Gateway> allGateways = airavataClient.getAllGateways(new AuthzToken(""));
        System.out.println(allGateways.size());
        if (airavataClient.isGatewayExist(new AuthzToken(""), gatewayId)) {
            Gateway gateway1 = airavataClient.getGateway(new AuthzToken(""), gatewayId);
            System.out.println(gateway1.getGatewayName());
        }
        boolean b = airavataClient.deleteGateway(new AuthzToken(""), "testGatewayId2");
        System.out.println(b);
    } 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)

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