use of org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile 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.GatewayResourceProfile in project airavata by apache.
the class AiravataIT method testCreateGateway.
@org.testng.annotations.Test(priority = 1)
public void testCreateGateway() {
try {
logger.info("testCreateGateway() -> Creating test gateway......");
setup.getGatewayRegister().createGateway();
GatewayResourceProfile gatewayResourceProfile = setup.getGatewayRegister().getGatewayResourceProfile();
Assert.assertNotNull(gatewayResourceProfile);
Gateway testGateway = setup.getGatewayRegister().getGateway(properties.getGname());
Assert.assertNotNull(testGateway);
Assert.assertEquals(testGateway.getGatewayName(), properties.getGname());
Assert.assertEquals(testGateway.getDomain(), properties.getGname() + properties.getGdomain());
Assert.assertEquals(testGateway.getGatewayApprovalStatus(), GatewayApprovalStatus.APPROVED);
String createdToken = setup.getGatewayRegister().writeToken();
Assert.assertEquals(new String(Files.readAllBytes(Paths.get(properties.getTokenFileLoc() + File.separator + TestFrameworkConstants.CredentialStoreConstants.TOKEN_FILE_NAME))), createdToken);
/*
TODO: Not required for local setup
FIXME: for scp transfer
Currently credential store does not support jpa its plane sql and need
*/
// setup.getGatewayRegister().registerSSHKeys();
logger.info("testCreateGateway() -> Created test gateway. Gateway Id : " + properties.getGname());
} catch (Exception e) {
logger.error("Error occured while testCreateGateways", e);
Assert.fail();
}
}
use of org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile 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);
}
}
use of org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile in project airavata by apache.
the class StorageResourceRegister method registerGatewayStorageProfile.
public void registerGatewayStorageProfile(String storageResourceId) throws Exception {
StoragePreference localResourcePreference = null;
try {
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(storageResourceId) && loginUserName.equals(LOGIN_USER)) {
localResourcePreference = createStoragePreferenceResource(resourceId, loginUserName, TestFrameworkConstants.STORAGE_LOCATION);
airavata.addGatewayStoragePreference(authzToken, gatewayResourceProfile.getGatewayID(), resourceId, localResourcePreference);
}
}
}
} catch (TException e) {
logger.error("Error occured while registering gateway storage profiles", e);
throw new Exception("Error occured while registering gateway storage profiles", e);
}
}
Aggregations