You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2019/06/28 16:08:44 UTC
[airavata] branch staging updated: FIx fetching all existing
GroupResourceProfiles
This is an automated email from the ASF dual-hosted git repository.
machristie pushed a commit to branch staging
in repository https://gitbox.apache.org/repos/asf/airavata.git
The following commit(s) were added to refs/heads/staging by this push:
new 3ba4e62 FIx fetching all existing GroupResourceProfiles
3ba4e62 is described below
commit 3ba4e62009db816eb35a78f2e9b86a76a2e6af50
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Fri Jun 28 12:08:31 2019 -0400
FIx fetching all existing GroupResourceProfiles
---
.../registry/migrator/airavata/AiravataDataMigrator.java | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/modules/sharing-registry/sharing-data-migrator/src/main/java/org/apache/airavata/sharing/registry/migrator/airavata/AiravataDataMigrator.java b/modules/sharing-registry/sharing-data-migrator/src/main/java/org/apache/airavata/sharing/registry/migrator/airavata/AiravataDataMigrator.java
index 57857fd..dc16174 100644
--- a/modules/sharing-registry/sharing-data-migrator/src/main/java/org/apache/airavata/sharing/registry/migrator/airavata/AiravataDataMigrator.java
+++ b/modules/sharing-registry/sharing-data-migrator/src/main/java/org/apache/airavata/sharing/registry/migrator/airavata/AiravataDataMigrator.java
@@ -315,7 +315,7 @@ public class AiravataDataMigrator {
// Migrating from GatewayResourceProfile to GroupResourceProfile
for (String domainID : domainOwnerMap.keySet()) {
GatewayGroups gatewayGroups = gatewayGroupsMap.get(domainID);
- if (needsGroupResourceProfileMigration(domainID, registryServiceClient)) {
+ if (needsGroupResourceProfileMigration(domainID, domainOwnerMap.get(domainID), registryServiceClient, sharingRegistryServerHandler)) {
GroupResourceProfile groupResourceProfile = migrateGatewayResourceProfileToGroupResourceProfile(domainID, registryServiceClient);
@@ -545,10 +545,19 @@ public class AiravataDataMigrator {
return userGroup;
}
- private static boolean needsGroupResourceProfileMigration(String gatewayId, RegistryService.Client registryServiceClient) throws TException {
+ private static boolean needsGroupResourceProfileMigration(String gatewayId, String domainOwnerId, RegistryService.Client registryServiceClient, SharingRegistryServerHandler sharingRegistryServerHandler)
+ throws TException {
// Return true if GatewayResourceProfile has at least one ComputeResourcePreference and there is no GroupResourceProfile
List<ComputeResourcePreference> computeResourcePreferences = registryServiceClient.getAllGatewayComputeResourcePreferences(gatewayId);
- List<GroupResourceProfile> groupResourceProfiles = registryServiceClient.getGroupResourceList(gatewayId, Collections.emptyList());
+ SearchCriteria searchCriteria = new SearchCriteria();
+ searchCriteria.setSearchField(EntitySearchField.ENTITY_TYPE_ID);
+ searchCriteria.setSearchCondition(SearchCondition.EQUAL);
+ searchCriteria.setValue(gatewayId + ":" + ResourceType.GROUP_RESOURCE_PROFILE.name());
+ List<String> accessibleGRPIds = sharingRegistryServerHandler.searchEntities(gatewayId, domainOwnerId, Collections.singletonList(searchCriteria), 0, -1)
+ .stream()
+ .map(p -> p.getEntityId())
+ .collect(Collectors.toList());
+ List<GroupResourceProfile> groupResourceProfiles = registryServiceClient.getGroupResourceList(gatewayId, accessibleGRPIds);
return !computeResourcePreferences.isEmpty() && groupResourceProfiles.isEmpty();
}