use of org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference in project airavata by apache.
the class RegisterOGCEUS3Application method registerGatewayResourceProfile.
public static void registerGatewayResourceProfile() {
try {
System.out.println("#### Registering Gateway proflie #### \n");
ComputeResourcePreference stampedeResourcePreferences = RegisterSampleApplicationsUtils.createComputeResourcePreference(stampedeResourceId, "TG-STA110014S", false, null, null, null, "/scratch/01437/ogce/ultrascan_testing/");
ComputeResourcePreference trestlesResourcePreferences = RegisterSampleApplicationsUtils.createComputeResourcePreference(trestlesResourceId, "sds128", false, null, null, null, "/oasis/scratch/trestles/ogce/temp_project/gta-work-dirs/");
// ComputeResourcePreference lonestarResourcePreferences = RegisterSampleApplicationsUtils.
// createComputeResourcePreference(lonestarResourceId, "ULTRASCAN", false, null, null, null,
// "/scratch/01623/us3/airavata/");
//
// ComputeResourcePreference alamoResourcePreferences = RegisterSampleApplicationsUtils.
// createComputeResourcePreference(alamoResourceId, null, false, null, null, null,
// "/mnt/glusterfs/work/");
GatewayResourceProfile gatewayResourceProfile = new GatewayResourceProfile();
gatewayResourceProfile.setGatewayID(DEFAULT_GATEWAY);
gatewayResourceProfile.addToComputeResourcePreferences(stampedeResourcePreferences);
gatewayResourceProfile.addToComputeResourcePreferences(trestlesResourcePreferences);
// gatewayResourceProfile.addToComputeResourcePreferences(lonestarResourcePreferences);
// gatewayResourceProfile.addToComputeResourcePreferences(alamoResourcePreferences);
String gatewayProfile = airavataClient.registerGatewayResourceProfile(new AuthzToken(""), gatewayResourceProfile);
System.out.println("Gateway Profile is registered with Id " + gatewayProfile);
} catch (TException e) {
e.printStackTrace();
}
}
use of org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference in project airavata by apache.
the class AiravataServerHandler method getGatewayComputeResourcePreference.
/**
* Fetch a Compute Resource Preference of a registered gateway profile.
*
* @param gatewayID The identifier for the gateway profile to be requested
* @param computeResourceId Preferences related to a particular compute resource
* @return computeResourcePreference
* Returns the ComputeResourcePreference object.
*/
@Override
@SecurityCheck
public ComputeResourcePreference getGatewayComputeResourcePreference(AuthzToken authzToken, String gatewayID, String computeResourceId) throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException {
RegistryService.Client regClient = registryClientPool.getResource();
try {
ComputeResourcePreference result = regClient.getGatewayComputeResourcePreference(gatewayID, computeResourceId);
registryClientPool.returnResource(regClient);
return result;
} catch (Exception e) {
logger.error(gatewayID, "Error while reading gateway compute resource preference...", e);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while reading gateway compute resource preference. More info : " + e.getMessage());
registryClientPool.returnBrokenResource(regClient);
throw exception;
}
}
use of org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference in project airavata by apache.
the class RegisterUS3Application method registerGatewayResourceProfile.
public static void registerGatewayResourceProfile() {
try {
System.out.println("#### Registering Gateway proflie #### \n");
ComputeResourcePreference stampedeResourcePreferences = RegisterSampleApplicationsUtils.createComputeResourcePreference(stampedeResourceId, "TG-MCB070039N", false, null, null, null, "/scratch/01623/us3/jobs/");
ComputeResourcePreference trestlesResourcePreferences = RegisterSampleApplicationsUtils.createComputeResourcePreference(trestlesResourceId, "uot111", false, null, null, null, "/oasis/projects/nsf/uot111/us3/airavata-workdirs/");
ComputeResourcePreference lonestarResourcePreferences = RegisterSampleApplicationsUtils.createComputeResourcePreference(lonestarResourceId, "ULTRASCAN", false, null, null, null, "/scratch/01623/us3/airavata/");
ComputeResourcePreference alamoResourcePreferences = RegisterSampleApplicationsUtils.createComputeResourcePreference(alamoResourceId, null, false, null, null, null, "/mnt/glusterfs/work/");
GatewayResourceProfile gatewayResourceProfile = new GatewayResourceProfile();
gatewayResourceProfile.setGatewayID(DEFAULT_GATEWAY);
gatewayResourceProfile.addToComputeResourcePreferences(stampedeResourcePreferences);
gatewayResourceProfile.addToComputeResourcePreferences(trestlesResourcePreferences);
gatewayResourceProfile.addToComputeResourcePreferences(lonestarResourcePreferences);
gatewayResourceProfile.addToComputeResourcePreferences(alamoResourcePreferences);
String gatewayProfile = airavataClient.registerGatewayResourceProfile(new AuthzToken(""), gatewayResourceProfile);
System.out.println("Gateway Profile is registered with Id " + gatewayProfile);
} catch (TException e) {
e.printStackTrace();
}
}
use of org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference in project airavata by apache.
the class RegisterSampleApplicationsUtils method createComputeResourcePreference.
public static ComputeResourcePreference createComputeResourcePreference(String computeResourceId, String allocationProjectNumber, boolean overridebyAiravata, String preferredBatchQueue, JobSubmissionProtocol preferredJobSubmissionProtocol, DataMovementProtocol preferredDataMovementProtocol, String scratchLocation) {
ComputeResourcePreference computeResourcePreference = new ComputeResourcePreference();
computeResourcePreference.setComputeResourceId(computeResourceId);
computeResourcePreference.setOverridebyAiravata(overridebyAiravata);
computeResourcePreference.setAllocationProjectNumber(allocationProjectNumber);
computeResourcePreference.setPreferredBatchQueue(preferredBatchQueue);
computeResourcePreference.setPreferredDataMovementProtocol(preferredDataMovementProtocol);
computeResourcePreference.setPreferredJobSubmissionProtocol(preferredJobSubmissionProtocol);
computeResourcePreference.setScratchLocation(scratchLocation);
return computeResourcePreference;
}
use of org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference in project airavata by apache.
the class ComputeResourceRegister method registerGatewayResourceProfile.
public void registerGatewayResourceProfile(String computeResourceId) throws Exception {
try {
ComputeResourcePreference localResourcePreference = null;
loginNamesWithResourceIds = getLoginNamesWithResourceIDs();
List<GatewayResourceProfile> allGatewayComputeResources = airavata.getAllGatewayResourceProfiles(authzToken);
for (GatewayResourceProfile gatewayResourceProfile : allGatewayComputeResources) {
for (String resourceId : loginNamesWithResourceIds.keySet()) {
String loginUserName = loginNamesWithResourceIds.get(resourceId);
if (resourceId.equals(computeResourceId) && loginUserName.equals(LOGIN_USER)) {
localResourcePreference = createComputeResourcePreference(resourceId, ALLOCATION_PROJECT_NUMBER, true, BATCH_QUEUE, JobSubmissionProtocol.LOCAL, DataMovementProtocol.LOCAL, TestFrameworkConstants.SCRATCH_LOCATION, loginUserName);
airavata.addGatewayComputeResourcePreference(authzToken, gatewayResourceProfile.getGatewayID(), resourceId, localResourcePreference);
}
}
}
} catch (TException e) {
logger.error("Error occured while updating gateway resource profiles", e);
throw new Exception("Error occured while updating gateway resource profiles", e);
}
}
Aggregations