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