Search in sources :

Example 1 with AuthzToken

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

the class DataRetrievalIT method setUp.

@BeforeTest
public void setUp() throws Exception {
    init();
    authzToken = new AuthzToken("empty token");
    experimentDataList = new ArrayList<String[]>();
    addApplications();
    addProjects();
    log.info("Setup Experiments");
    log.info("=================");
    for (int i = 1; i <= NUM_OF_EXPERIMENTS; i++) {
        // we are using the last user or project to test data empty scenarios
        String user = users[(new Random()).nextInt(users.length)];
        String project = projectIds.get((new Random()).nextInt(projectIds.size() - 1));
        String experimentId = runExperiment(user, project);
        experimentDataList.add(new String[] { experimentId, user, project });
        log.info("Running experiment " + i + " of " + NUM_OF_EXPERIMENTS + " - " + experimentId);
    }
}
Also used : Random(java.util.Random) AuthzToken(org.apache.airavata.model.security.AuthzToken) BeforeTest(org.testng.annotations.BeforeTest)

Example 2 with AuthzToken

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

the class SimpleEchoIT method setUp.

@BeforeTest
public void setUp() throws Exception {
    // Thread.sleep(20000);
    init();
    authzToken = new AuthzToken("empty token");
}
Also used : AuthzToken(org.apache.airavata.model.security.AuthzToken) BeforeTest(org.testng.annotations.BeforeTest)

Example 3 with AuthzToken

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

the class WorkflowIntegrationTestBase method setUpEnvironment.

public void setUpEnvironment() throws Exception {
    log("..................Validating myproxy username, password set properly .............................");
    System.setProperty("myproxy.user", "ogce");
    System.setProperty("myproxy.password", "/Users/chathuri/dev/airavata/cert/certificates");
    System.setProperty("trusted.cert.location", "/Users/chathuri/dev/airavata/cert/certificates");
    String myProxyUserName = System.getProperty("myproxy.user");
    String myProxyPassword = System.getProperty("myproxy.password");
    String certLocation = System.getProperty("trusted.cert.location");
    authzToken = new AuthzToken("empty token");
    if (myProxyUserName == null || myProxyPassword == null || certLocation == null) {
        log.error(">>>>>> Please run tests with my proxy user name, password and grid cert location. " + "E.g :- mvn clean install -Duser=xxx -Dpwd=xxx -Dcert=/path<<<<<<<");
        throw new Exception("Need my proxy user name password to run tests.");
    } else {
        ServerSettings.setSetting(MYPROXY_USER_NAME, myProxyUserName);
        ServerSettings.setSetting(MYPROXY_PWD, myProxyPassword);
        ServerSettings.setSetting(CERT_LOCATION, certLocation);
        ServerSettings.setSetting(Constants.IS_API_SECURED, "false");
    }
}
Also used : AuthzToken(org.apache.airavata.model.security.AuthzToken) TException(org.apache.thrift.TException)

Example 4 with AuthzToken

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

the class CreateLaunchExperiment method createEchoExperimentForStampede.

// public static String createExperimentForSSHHost(Airavata.Client client) throws TException {
// try {
// List<OutputDataObjectType> exInputs = new ArrayList<OutputDataObjectType>();
// OutputDataObjectType input = new OutputDataObjectType();
// input.setName("echo_input");
// input.setType(DataType.STRING);
// input.setValue("Echoed_Output=Hello World");
// exInputs.add(input);
// 
// List<OutputDataObjectType> exOut = new ArrayList<OutputDataObjectType>();
// OutputDataObjectType output = new OutputDataObjectType();
// output.setName("Echoed_Output");
// output.setType(DataType.STRING);
// output.setValue("");
// exOut.add(output);
// 
// Project project = ProjectModelUtil.createProject("default", "admin", "test project");
// String projectId = client.createProject(project);
// 
// ExperimentModel simpleExperiment =
// ExperimentModelUtil.createSimpleExperiment(projectId, "admin", "sshEchoExperiment", "SSHEcho1", sshHostAppId.split(",")[1], exInputs);
// simpleExperiment.setExperimentOutputs(exOut);
// 
// ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling(sshHostAppId.split(",")[0], 1, 1, 1, "normal", 1, 0, 1, "sds128");
// scheduling.setResourceHostId("gw111.iu.xsede.org");
// UserConfigurationDataModel userConfigurationData = new UserConfigurationDataModel();
// userConfigurationData.setAiravataAutoSchedule(false);
// userConfigurationData.setOverrideManualScheduledParams(false);
// userConfigurationData.setComputationalResourceScheduling(scheduling);
// simpleExperiment.setUserConfigurationData(userConfigurationData);
// return client.createExperiment(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);
// }
// }
public static String createEchoExperimentForStampede(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");
        // }
        // }
        // List<OutputDataObjectType> exOut = client.getApplicationOutputs(new AuthzToken(""), echoAppId);
        Project project = ProjectModelUtil.createProject("default", "admin", "test project");
        String projectId = client.createProject(new AuthzToken(""), DEFAULT_GATEWAY, project);
        ExperimentModel simpleExperiment = ExperimentModelUtil.createSimpleExperiment(DEFAULT_GATEWAY, projectId, "admin", "echoExperiment", "SimpleEcho3", 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(stampedeHostName)) {
                    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) Project(org.apache.airavata.model.workspace.Project) UserConfigurationDataModel(org.apache.airavata.model.experiment.UserConfigurationDataModel) AuthzToken(org.apache.airavata.model.security.AuthzToken) ComputationalResourceSchedulingModel(org.apache.airavata.model.scheduling.ComputationalResourceSchedulingModel)

Example 5 with AuthzToken

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

the class CreateLaunchExperiment method getExperiment.

public static void getExperiment(Airavata.Client client, String expId) throws Exception {
    try {
        ExperimentModel experiment = client.getExperiment(new AuthzToken(""), expId);
        List<ErrorModel> errors = experiment.getErrors();
        if (errors != null && !errors.isEmpty()) {
            for (ErrorModel error : errors) {
                System.out.println("ERROR MESSAGE : " + error.getActualErrorMessage());
            }
        }
    } catch (ExperimentNotFoundException e) {
        logger.error("Experiment does not exist", e);
        throw new ExperimentNotFoundException("Experiment does not exist");
    } catch (AiravataSystemException e) {
        logger.error("Error while retrieving experiment", e);
        throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
    } catch (InvalidRequestException e) {
        logger.error("Error while retrieving experiment", e);
        throw new InvalidRequestException("Error while retrieving experiment");
    } catch (AiravataClientException e) {
        logger.error("Error while retrieving experiment", e);
        throw new AiravataClientException(AiravataErrorType.INTERNAL_ERROR);
    }
}
Also used : ExperimentModel(org.apache.airavata.model.experiment.ExperimentModel) AuthzToken(org.apache.airavata.model.security.AuthzToken) ErrorModel(org.apache.airavata.model.commons.ErrorModel)

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