use of org.apache.airavata.registry.cpi.AppCatalogException in project airavata by apache.
the class ComputeResourceImpl method deleteResourceJobManager.
@Override
public void deleteResourceJobManager(String resourceJobManagerId) throws AppCatalogException {
try {
ResourceJobManagerResource resource = new ResourceJobManagerResource();
resource.remove(resourceJobManagerId);
} catch (Exception e) {
logger.error("Error while deleting resource job manager..", e);
throw new AppCatalogException(e);
}
}
use of org.apache.airavata.registry.cpi.AppCatalogException in project airavata by apache.
the class ComputeResourceImpl method addUnicoreDataMovement.
@Override
public String addUnicoreDataMovement(UnicoreDataMovement unicoreDataMovement) throws AppCatalogException {
try {
unicoreDataMovement.setDataMovementInterfaceId(AppCatalogUtils.getID("UNICORE"));
UnicoreDataMovementResource resource = AppCatalogThriftConversion.getUnicoreDMResource(unicoreDataMovement);
resource.save();
return resource.getDataMovementId();
} catch (Exception e) {
logger.error("Error while saving UNICORE Data Movement...", e);
throw new AppCatalogException(e);
}
}
use of org.apache.airavata.registry.cpi.AppCatalogException in project airavata by apache.
the class ComputeResourceImpl method getAvailableComputeResourceIdList.
@Override
public Map<String, String> getAvailableComputeResourceIdList() throws AppCatalogException {
try {
Map<String, String> computeResourceMap = new HashMap<String, String>();
ComputeResourceResource resource = new ComputeResourceResource();
List<AppCatalogResource> allComputeResources = resource.getAll();
if (allComputeResources != null && !allComputeResources.isEmpty()) {
for (AppCatalogResource cm : allComputeResources) {
ComputeResourceResource cmr = (ComputeResourceResource) cm;
if (cmr.isEnabled()) {
computeResourceMap.put(cmr.getResourceId(), cmr.getHostName());
}
}
}
return computeResourceMap;
} catch (Exception e) {
logger.error("Error while retrieving compute resource list...", e);
throw new AppCatalogException(e);
}
}
use of org.apache.airavata.registry.cpi.AppCatalogException in project airavata by apache.
the class GwyResourceProfileImpl method getStoragePreference.
@Override
public StoragePreference getStoragePreference(String gatewayId, String storageId) throws AppCatalogException {
try {
StoragePreferenceResource prefResource = new StoragePreferenceResource();
List<AppCatalogResource> computePrefList = prefResource.get(AppCatAbstractResource.ComputeResourcePreferenceConstants.GATEWAY_ID, gatewayId);
for (AppCatalogResource resource : computePrefList) {
StoragePreferenceResource dsP = (StoragePreferenceResource) resource;
if (dsP.getStorageResourceId() != null && !dsP.getStorageResourceId().equals("")) {
if (dsP.getStorageResourceId().equals(storageId)) {
return AppCatalogThriftConversion.getDataStoragePreference(dsP);
}
}
}
} catch (Exception e) {
logger.error("Error while retrieving data storage preference...", e);
throw new AppCatalogException(e);
}
return null;
}
use of org.apache.airavata.registry.cpi.AppCatalogException in project airavata by apache.
the class GwyResourceProfileImpl method updateGatewayResourceProfile.
@Override
public void updateGatewayResourceProfile(String gatewayId, org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile updatedProfile) throws AppCatalogException {
try {
GatewayProfileResource profileResource = new GatewayProfileResource();
GatewayProfileResource existingGP = (GatewayProfileResource) profileResource.get(gatewayId);
existingGP.setCredentialStoreToken(updatedProfile.getCredentialStoreToken());
existingGP.setIdentityServerTenant(updatedProfile.getIdentityServerTenant());
existingGP.setIdentityServerPwdCredToken(updatedProfile.getIdentityServerPwdCredToken());
existingGP.save();
List<ComputeResourcePreference> computeResourcePreferences = updatedProfile.getComputeResourcePreferences();
if (computeResourcePreferences != null && !computeResourcePreferences.isEmpty()) {
for (ComputeResourcePreference preference : computeResourcePreferences) {
ComputeHostPreferenceResource resource = new ComputeHostPreferenceResource();
resource.setGatewayProfile(existingGP);
resource.setResourceId(preference.getComputeResourceId());
ComputeResourceResource computeHostResource = new ComputeResourceResource();
resource.setComputeHostResource((ComputeResourceResource) computeHostResource.get(preference.getComputeResourceId()));
resource.setGatewayId(gatewayId);
resource.setLoginUserName(preference.getLoginUserName());
resource.setOverrideByAiravata(preference.isOverridebyAiravata());
if (preference.getPreferredJobSubmissionProtocol() != null) {
resource.setPreferredJobProtocol(preference.getPreferredJobSubmissionProtocol().toString());
}
if (preference.getPreferredDataMovementProtocol() != null) {
resource.setPreferedDMProtocol(preference.getPreferredDataMovementProtocol().toString());
}
resource.setBatchQueue(preference.getPreferredBatchQueue());
resource.setProjectNumber(preference.getAllocationProjectNumber());
resource.setScratchLocation(preference.getScratchLocation());
resource.setResourceCSToken(preference.getResourceSpecificCredentialStoreToken());
resource.setUsageReportingGatewayId(preference.getUsageReportingGatewayId());
resource.setQualityOfService(preference.getQualityOfService());
resource.setReservation(preference.getReservation());
if (preference.getReservationStartTime() > 0) {
resource.setReservationStartTime(AiravataUtils.getTime(preference.getReservationStartTime()));
}
if (preference.getReservationEndTime() > 0) {
resource.setReservationEndTime(AiravataUtils.getTime(preference.getReservationEndTime()));
}
resource.setSshAccountProvisioner(preference.getSshAccountProvisioner());
if (preference.getSshAccountProvisionerConfig() != null && !preference.getSshAccountProvisionerConfig().isEmpty()) {
Map<String, String> sshAccountProvisionerConfigurationsCopy = new HashMap<>(preference.getSshAccountProvisionerConfig());
resource.setSshAccountProvisionerConfigurations(sshAccountProvisionerConfigurationsCopy);
}
resource.setSshAccountProvisionerAdditionalInfo(preference.getSshAccountProvisionerAdditionalInfo());
resource.save();
}
}
List<StoragePreference> dataStoragePreferences = updatedProfile.getStoragePreferences();
if (dataStoragePreferences != null && !dataStoragePreferences.isEmpty()) {
for (StoragePreference storagePreference : dataStoragePreferences) {
StoragePreferenceResource resource = new StoragePreferenceResource();
resource.setStorageResourceId(storagePreference.getStorageResourceId());
resource.setGatewayId(existingGP.getGatewayID());
resource.setFsRootLocation(storagePreference.getFileSystemRootLocation());
resource.setLoginUserName(storagePreference.getLoginUserName());
resource.setResourceCSToken(storagePreference.getResourceSpecificCredentialStoreToken());
resource.setGatewayProfile(existingGP);
resource.save();
}
}
} catch (Exception e) {
logger.error("Error while updating gateway profile...", e);
throw new AppCatalogException(e);
}
}
Aggregations