You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sh...@apache.org on 2016/10/07 20:52:35 UTC
[08/31] airavata git commit: Feature request: User Compute Preference
Feature request: User Compute Preference
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/81c6ea84
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/81c6ea84
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/81c6ea84
Branch: refs/heads/develop
Commit: 81c6ea841e265dc8f7f159e4bbe0d1457db2b213
Parents: e317d77
Author: Anuj Bhandar <bh...@gmail.com>
Authored: Sun Oct 2 20:57:28 2016 -0400
Committer: Anuj Bhandar <bh...@gmail.com>
Committed: Sun Oct 2 20:57:28 2016 -0400
----------------------------------------------------------------------
.../server/handler/AiravataServerHandler.java | 276 +-
.../java/org/apache/airavata/api/Airavata.java | 57691 +++++++++++------
.../UserComputeResourcePreference.java | 1381 +
.../UserResourceProfile.java | 1169 +
.../UserStoragePreference.java | 728 +
.../org/apache/airavata/model/job/JobModel.java | 103 +-
.../airavata/model/process/ProcessModel.java | 179 +-
.../apache/airavata/model/task/TaskModel.java | 178 +-
.../core/app/catalog/impl/AppCatalogImpl.java | 5 +
.../catalog/impl/UsrResourceProfileImpl.java | 356 +
.../model/UserComputeResourcePreference.java | 186 +
.../model/UserComputeResourcePreferencePK.java | 73 +
.../app/catalog/model/UserResourceProfile.java | 109 +
.../catalog/model/UserStoragePreference.java | 106 +
.../catalog/model/UserStoragePreferencePK.java | 73 +
.../resources/AppCatAbstractResource.java | 24 +
.../ComputeHostPreferenceResource.java | 4 +
.../UserComputeHostPreferenceResource.java | 451 +
.../resources/UserResourceProfileResource.java | 425 +
.../UserStoragePreferenceResource.java | 371 +
.../catalog/util/AppCatalogResourceType.java | 3 +
.../util/AppCatalogThriftConversion.java | 63 +
.../airavata/registry/cpi/AppCatalog.java | 7 +
.../registry/cpi/UsrResourceProfile.java | 87 +
.../service/handler/RegistryServerHandler.java | 2 +-
.../airavata/registry/api/RegistryService.java | 31191 ++++++---
.../api/exception/RegistryServiceException.java | 2 +-
.../airavata-apis/airavata_api.thrift | 336 +-
.../component-cpis/registry-api.thrift | 282 +
.../resource_catalog_models.thrift | 3 +-
.../user_resource_profile_model.thrift | 105 +
31 files changed, 69649 insertions(+), 26320 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/81c6ea84/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
index 5ccf874..3f7773f 100644
--- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
+++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
@@ -49,10 +49,13 @@ import org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentD
import org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule;
import org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription;
import org.apache.airavata.model.appcatalog.computeresource.*;
-import org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference;
import org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile;
+import org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference;
import org.apache.airavata.model.appcatalog.gatewayprofile.StoragePreference;
import org.apache.airavata.model.appcatalog.storageresource.StorageResourceDescription;
+import org.apache.airavata.model.appcatalog.userresourceprofile.UserResourceProfile;
+import org.apache.airavata.model.appcatalog.userresourceprofile.UserComputeResourcePreference;
+import org.apache.airavata.model.appcatalog.userresourceprofile.UserStoragePreference;
import org.apache.airavata.model.application.io.InputDataObjectType;
import org.apache.airavata.model.application.io.OutputDataObjectType;
import org.apache.airavata.model.commons.airavata_commonsConstants;
@@ -3128,6 +3131,277 @@ public class AiravataServerHandler implements Airavata.Iface {
}
}
+ /**
+ * Register a User Resource Profile.
+ *
+ * @param UserResourceProfile User Resource Profile Object.
+ * The userId should be obtained from Airavata user profile registration and passed to register a corresponding
+ * resource profile.
+ * @return status.
+ * Returns a success/failure of the registration.
+ */
+ @Override
+ @SecurityCheck
+ public String registerUserResourceProfile(AuthzToken authzToken, UserResourceProfile userResourceProfile)
+ throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException {
+ try {
+ return getRegistryServiceClient().registerUserResourceProfile(userResourceProfile);
+ } catch (ApplicationSettingsException | RegistryServiceException e) {
+ logger.error("Error while registering user resource profile...", e);
+ AiravataSystemException exception = new AiravataSystemException();
+ exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
+ exception.setMessage("Error while registering user resource profile. More info : " + e.getMessage());
+ throw exception;
+ }
+ }
+
+ /**
+ * Fetch the given User Resource Profile.
+ *
+ * @param userId The identifier for the requested User resource
+ *
+ * @param gatewayID The identifier to link a gateway for the requested User resource
+ *
+ * @return userResourceProfile
+ * User Resource Profile Object.
+ */
+ @Override
+ @SecurityCheck
+ public UserResourceProfile getUserResourceProfile(AuthzToken authzToken, String userId, String gatewayID) throws InvalidRequestException,
+ AiravataClientException, AiravataSystemException, AuthorizationException, TException {
+ try {
+ return getRegistryServiceClient().getUserResourceProfile(userId, gatewayID);
+ } catch (ApplicationSettingsException | RegistryServiceException e) {
+ logger.error(userId, "Error while retrieving user resource profile...", e);
+ AiravataSystemException exception = new AiravataSystemException();
+ exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
+ exception.setMessage("Error while retrieving user resource profile. More info : " + e.getMessage());
+ throw exception;
+ }
+ }
+
+ /**
+ * Update a User Resource Profile.
+ *
+ * @param userId : The identifier for the requested user resource profile to be updated.
+ * @param gatewayID The identifier to link a gateway for the requested User resource
+ * @param userResourceProfile User Resource Profile Object.
+ * @return status
+ * Returns a success/failure of the update.
+ */
+ @Override
+ @SecurityCheck
+ public boolean updateUserResourceProfile(AuthzToken authzToken,
+ String userId,
+ String gatewayID,
+ UserResourceProfile userResourceProfile) throws TException {
+ try {
+ return getRegistryServiceClient().updateUserResourceProfile(userId, gatewayID, userResourceProfile);
+ } catch (ApplicationSettingsException | RegistryServiceException e) {
+ logger.error(userId, "Error while updating user resource profile...", e);
+ AiravataSystemException exception = new AiravataSystemException();
+ exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
+ exception.setMessage("Error while updating user resource profile. More info : " + e.getMessage());
+ throw exception;
+ }
+ }
+
+ /**
+ * Delete the given User Resource Profile.
+ *
+ * @param userId : The identifier for the requested userId resource to be deleted.
+ * @param gatewayID The identifier to link a gateway for the requested User resource
+ * @return status
+ * Returns a success/failure of the deletion.
+ */
+ @Override
+ @SecurityCheck
+ public boolean deleteUserResourceProfile(AuthzToken authzToken, String userId, String gatewayID) throws TException {
+ try {
+ return getRegistryServiceClient().deleteUserResourceProfile(userId, gatewayID);
+ } catch (ApplicationSettingsException | RegistryServiceException e) {
+ logger.error(userId, "Error while removing user resource profile...", e);
+ AiravataSystemException exception = new AiravataSystemException();
+ exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
+ exception.setMessage("Error while removing user resource profile. More info : " + e.getMessage());
+ throw exception;
+ }
+ }
+
+ /**
+ * Add a Compute Resource Preference to a registered User Resource profile.
+ *
+ * @param userId The identifier for the User Resource profile to be added.
+ * @param gatewayID The identifier to link a gateway for the requested User resource
+ * @param userComputeResourceId Preferences related to a particular compute resource
+ * @param userComputeResourcePreference The ComputeResourcePreference object to be added to the resource profile.
+ * @return status
+ * Returns a success/failure of the addition. If a profile already exists, this operation will fail.
+ * Instead an update should be used.
+ */
+ @Override
+ @SecurityCheck
+ public boolean addUserComputeResourcePreference(AuthzToken authzToken, String userId, String gatewayID, String userComputeResourceId,
+ UserComputeResourcePreference userComputeResourcePreference) throws InvalidRequestException,
+ AiravataClientException, AiravataSystemException, AuthorizationException, TException {
+ try {
+ return getRegistryServiceClient().addUserComputeResourcePreference(userId, gatewayID, userComputeResourceId, userComputeResourcePreference);
+ } catch (ApplicationSettingsException | RegistryServiceException e) {
+ logger.error(userId, "Error while registering user resource profile preference...", e);
+ AiravataSystemException exception = new AiravataSystemException();
+ exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
+ exception.setMessage("Error while registering user resource profile preference. More info : " + e.getMessage());
+ throw exception;
+ }
+ }
+
+ @Override
+ @SecurityCheck
+ public boolean addUserStoragePreference(AuthzToken authzToken, String userId, String gatewayID, String userStorageResourceId, UserStoragePreference dataStoragePreference)
+ throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException {
+ try {
+ return getRegistryServiceClient().addUserStoragePreference(userId, gatewayID, userStorageResourceId, dataStoragePreference);
+ } catch (ApplicationSettingsException | RegistryServiceException e) {
+ logger.error(userId, "Error while registering user storage preference...", e);
+ AiravataSystemException exception = new AiravataSystemException();
+ exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
+ exception.setMessage("Error while registering user storage preference. More info : " + e.getMessage());
+ throw exception;
+ }
+ }
+
+ /**
+ * Fetch a Compute Resource Preference of a registered User Resource profile.
+ *
+ * @param userId : The identifier for the User Resource profile to be requested
+ * @param gatewayID The identifier to link a gateway for the requested User resource
+ * @param userComputeResourceId Preferences related to a particular compute resource
+ * @return computeResourcePreference
+ * Returns the ComputeResourcePreference object.
+ */
+ @Override
+ @SecurityCheck
+ public ComputeResourcePreference getUserComputeResourcePreference(AuthzToken authzToken, String userId, String gatewayID, String userComputeResourceId)
+ throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException {
+ try {
+ return getRegistryServiceClient().getUserComputeResourcePreference(userId, gatewayID, userComputeResourceId);
+ } catch (ApplicationSettingsException | RegistryServiceException e) {
+ logger.error(userId, "Error while reading user compute resource preference...", e);
+ AiravataSystemException exception = new AiravataSystemException();
+ exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
+ exception.setMessage("Error while reading user compute resource preference. More info : " + e.getMessage());
+ throw exception;
+ }
+ }
+
+ @Override
+ @SecurityCheck
+ public StoragePreference getUserStoragePreference(AuthzToken authzToken, String userId, String gatewayID, String userStorageId) throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException {
+ try {
+ return getRegistryServiceClient().getUserStoragePreference(userId, gatewayID, userStorageId);
+ } catch (ApplicationSettingsException | RegistryServiceException e) {
+ logger.error(userId, "Error while reading user data storage preference...", e);
+ AiravataSystemException exception = new AiravataSystemException();
+ exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
+ exception.setMessage("Error while reading user data storage preference. More info : " + e.getMessage());
+ throw exception;
+ }
+ }
+
+ @Override
+ @SecurityCheck
+ public List<UserResourceProfile> getAllUserResourceProfiles(AuthzToken authzToken) throws InvalidRequestException,
+ AiravataClientException, AiravataSystemException, AuthorizationException, TException {
+ try {
+ return getRegistryServiceClient().getAllUserResourceProfiles();
+ } catch (ApplicationSettingsException | RegistryServiceException e) {
+ AiravataSystemException exception = new AiravataSystemException();
+ exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
+ exception.setMessage("Error while reading retrieving all user resource profiles. More info : " + e.getMessage());
+ throw exception;
+ }
+ }
+
+ /**
+ * Update a Compute Resource Preference to a registered User Resource profile.
+ *
+ * @param userId : The identifier for the User Resource profile to be updated.
+ * @param gatewayID The identifier to link a gateway for the requested User resource
+ * @param userComputeResourceId Preferences related to a particular compute resource
+ * @param userComputeResourcePreference The ComputeResourcePreference object to be updated to the resource profile.
+ * @return status
+ * Returns a success/failure of the updation.
+ */
+ @Override
+ @SecurityCheck
+ public boolean updateUserComputeResourcePreference(AuthzToken authzToken, String userId, String gatewayID, String userComputeResourceId,
+ UserComputeResourcePreference userComputeResourcePreference)
+ throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException {
+ try {
+ return getRegistryServiceClient().updateUserComputeResourcePreference(userId, gatewayID, userComputeResourceId, userComputeResourcePreference);
+ } catch (ApplicationSettingsException | RegistryServiceException e) {
+ logger.error(userId, "Error while reading user compute resource preference...", e);
+ AiravataSystemException exception = new AiravataSystemException();
+ exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
+ exception.setMessage("Error while updating user compute resource preference. More info : " + e.getMessage());
+ throw exception;
+ }
+ }
+
+ @Override
+ @SecurityCheck
+ public boolean updateUserStoragePreference(AuthzToken authzToken, String userId, String gatewayID, String userStorageId, UserStoragePreference dataStoragePreference) throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException {
+ try {
+ return getRegistryServiceClient().updateUserStoragePreference(userId, gatewayID, userStorageId, dataStoragePreference);
+ } catch (ApplicationSettingsException | RegistryServiceException e) {
+ logger.error(userId, "Error while reading user data storage preference...", e);
+ AiravataSystemException exception = new AiravataSystemException();
+ exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
+ exception.setMessage("Error while updating user data storage preference. More info : " + e.getMessage());
+ throw exception;
+ }
+ }
+
+ /**
+ * Delete the Compute Resource Preference of a registered User Resource profile.
+ *
+ * @param userId The identifier for the User profile to be deleted.
+ * @param gatewayID The identifier to link a gateway for the requested User resource
+ * @param userComputeResourceId Preferences related to a particular compute resource
+ * @return status
+ * Returns a success/failure of the deletion.
+ */
+ @Override
+ @SecurityCheck
+ public boolean deleteUserComputeResourcePreference(AuthzToken authzToken, String userId,String gatewayID, String userComputeResourceId)
+ throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException {
+ try {
+ return getRegistryServiceClient().deleteUserComputeResourcePreference(userId, gatewayID, userComputeResourceId);
+ } catch (ApplicationSettingsException | RegistryServiceException e) {
+ logger.error(userId, "Error while reading user compute resource preference...", e);
+ AiravataSystemException exception = new AiravataSystemException();
+ exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
+ exception.setMessage("Error while updating user compute resource preference. More info : " + e.getMessage());
+ throw exception;
+ }
+ }
+
+ @Override
+ @SecurityCheck
+ public boolean deleteUserStoragePreference(AuthzToken authzToken, String userId, String gatewayID, String userStorageId) throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException {
+ try {
+ return getRegistryServiceClient().deleteUserStoragePreference(userId, gatewayID, userStorageId);
+ } catch (ApplicationSettingsException | RegistryServiceException e) {
+ logger.error(userId, "Error while reading user data storage preference...", e);
+ AiravataSystemException exception = new AiravataSystemException();
+ exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
+ exception.setMessage("Error while updating user data storage preference. More info : " + e.getMessage());
+ throw exception;
+ }
+ }
+
+
+
@Override
@SecurityCheck
public List<String> getAllWorkflows(AuthzToken authzToken, String gatewayId) throws InvalidRequestException,