Search in sources :

Example 56 with AppCatalogException

use of org.apache.airavata.registry.cpi.AppCatalogException in project airavata by apache.

the class ComputeResourceImpl method removeDataMovementInterface.

@Override
public void removeDataMovementInterface(String computeResourceId, String dataMovementInterfaceId) throws AppCatalogException {
    try {
        DataMovementInterfaceResource resource = new DataMovementInterfaceResource();
        Map<String, String> ids = new HashMap<String, String>();
        ids.put(AppCatAbstractResource.DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID, computeResourceId);
        ids.put(AppCatAbstractResource.DataMovementInterfaceConstants.DATA_MOVEMENT_INTERFACE_ID, dataMovementInterfaceId);
        resource.remove(ids);
    } catch (Exception e) {
        logger.error("Error while removing data movement interface..", e);
        throw new AppCatalogException(e);
    }
}
Also used : AppCatalogException(org.apache.airavata.registry.cpi.AppCatalogException) HashMap(java.util.HashMap) AppCatalogException(org.apache.airavata.registry.cpi.AppCatalogException)

Example 57 with AppCatalogException

use of org.apache.airavata.registry.cpi.AppCatalogException in project airavata by apache.

the class ComputeResourceImpl method addSSHJobSubmission.

@Override
public String addSSHJobSubmission(SSHJobSubmission sshJobSubmission) throws AppCatalogException {
    try {
        String submissionId = AppCatalogUtils.getID("SSH");
        sshJobSubmission.setJobSubmissionInterfaceId(submissionId);
        String resourceJobManagerId = addResourceJobManager(sshJobSubmission.getResourceJobManager());
        SshJobSubmissionResource resource = AppCatalogThriftConversion.getSSHJobSubmission(sshJobSubmission);
        resource.setResourceJobManagerId(resourceJobManagerId);
        resource.getResourceJobManagerResource().setResourceJobManagerId(resourceJobManagerId);
        if (sshJobSubmission.getMonitorMode() != null) {
            resource.setMonitorMode(sshJobSubmission.getMonitorMode().toString());
        }
        resource.save();
        return submissionId;
    } catch (Exception e) {
        logger.error("Error while saving SSH Job Submission...", e);
        throw new AppCatalogException(e);
    }
}
Also used : AppCatalogException(org.apache.airavata.registry.cpi.AppCatalogException) AppCatalogException(org.apache.airavata.registry.cpi.AppCatalogException)

Example 58 with AppCatalogException

use of org.apache.airavata.registry.cpi.AppCatalogException in project airavata by apache.

the class ComputeResourceImpl method addDataMovementProtocol.

@Override
public String addDataMovementProtocol(String resourceId, DMType dmType, DataMovementInterface dataMovementInterface) throws AppCatalogException {
    try {
        String dmId = null;
        if (dmType.equals(DMType.COMPUTE_RESOURCE)) {
            DataMovementInterfaceResource dmi = AppCatalogThriftConversion.getDataMovementInterfaceResource(dataMovementInterface);
            dmi.setComputeResourceId(resourceId);
            ComputeResourceResource computeResourceResource = new ComputeResourceResource();
            computeResourceResource = (ComputeResourceResource) computeResourceResource.get(resourceId);
            dmi.setComputeHostResource(computeResourceResource);
            dmi.save();
            dmId = dmi.getDataMovementInterfaceId();
        } else if (dmType.equals(DMType.STORAGE_RESOURCE)) {
            StorageInterfaceResource storageInterface = AppCatalogThriftConversion.getStorageInterface(dataMovementInterface);
            storageInterface.setStorageResourceId(resourceId);
            StorageResourceResource storageResourceResource = new StorageResourceResource();
            storageResourceResource = (StorageResourceResource) storageResourceResource.get(resourceId);
            storageInterface.setStorageResourceResource(storageResourceResource);
            storageInterface.save();
            dmId = storageInterface.getDataMovementInterfaceId();
        }
        return dmId;
    } catch (Exception e) {
        logger.error("Error while saving " + dataMovementInterface.getDataMovementProtocol().toString() + " data movement Protocol...", e);
        throw new AppCatalogException(e);
    }
}
Also used : AppCatalogException(org.apache.airavata.registry.cpi.AppCatalogException) AppCatalogException(org.apache.airavata.registry.cpi.AppCatalogException)

Example 59 with AppCatalogException

use of org.apache.airavata.registry.cpi.AppCatalogException in project airavata by apache.

the class ComputeResourceImpl method getResourceJobManager.

@Override
public ResourceJobManager getResourceJobManager(String resourceJobManagerId) throws AppCatalogException {
    try {
        ResourceJobManagerResource resource = new ResourceJobManagerResource();
        ResourceJobManagerResource jobManagerResource = (ResourceJobManagerResource) resource.get(resourceJobManagerId);
        return AppCatalogThriftConversion.getResourceJobManager(jobManagerResource);
    } catch (Exception e) {
        logger.error("Error while retrieving resource job manager..", e);
        throw new AppCatalogException(e);
    }
}
Also used : AppCatalogException(org.apache.airavata.registry.cpi.AppCatalogException) AppCatalogException(org.apache.airavata.registry.cpi.AppCatalogException)

Example 60 with AppCatalogException

use of org.apache.airavata.registry.cpi.AppCatalogException in project airavata by apache.

the class ComputeResourceImpl method getUNICOREDataMovement.

@Override
public UnicoreDataMovement getUNICOREDataMovement(String dataMovementId) throws AppCatalogException {
    try {
        UnicoreDataMovementResource resource = new UnicoreDataMovementResource();
        resource = (UnicoreDataMovementResource) resource.get(dataMovementId);
        return AppCatalogThriftConversion.getUnicoreDMDescription(resource);
    } catch (Exception e) {
        logger.error("Error while retrieving UNICORE data movement...", e);
        throw new AppCatalogException(e);
    }
}
Also used : AppCatalogException(org.apache.airavata.registry.cpi.AppCatalogException) AppCatalogException(org.apache.airavata.registry.cpi.AppCatalogException)

Aggregations

AppCatalogException (org.apache.airavata.registry.cpi.AppCatalogException)353 ApplicationSettingsException (org.apache.airavata.common.exception.ApplicationSettingsException)268 EntityManager (javax.persistence.EntityManager)261 Query (javax.persistence.Query)176 AppCatalogQueryGenerator (org.apache.airavata.registry.core.app.catalog.util.AppCatalogQueryGenerator)176 ArrayList (java.util.ArrayList)94 HashMap (java.util.HashMap)70 Map (java.util.Map)54 List (java.util.List)42 CompositeIdentifier (org.apache.airavata.registry.cpi.CompositeIdentifier)22 ComputeResource (org.apache.airavata.registry.core.app.catalog.model.ComputeResource)14 ApplicationDeployment (org.apache.airavata.registry.core.app.catalog.model.ApplicationDeployment)13 ApplicationInterface (org.apache.airavata.registry.core.app.catalog.model.ApplicationInterface)10 ApplicationModule (org.apache.airavata.registry.core.app.catalog.model.ApplicationModule)8 GatewayProfile (org.apache.airavata.registry.core.app.catalog.model.GatewayProfile)6 ResourceJobManager (org.apache.airavata.registry.core.app.catalog.model.ResourceJobManager)6 StorageResource (org.apache.airavata.registry.core.app.catalog.model.StorageResource)6 Initialize (org.apache.airavata.app.catalog.util.Initialize)5 ProcessContext (org.apache.airavata.gfac.core.context.ProcessContext)5 GSISSHSubmission (org.apache.airavata.registry.core.app.catalog.model.GSISSHSubmission)5