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();
}
}
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;
}
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();
}
}
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();
}
}
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();
}
}
Aggregations