Search in sources :

Example 6 with AppCatalogException

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

the class AbstractSMSHandler method invoke.

@Override
public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException {
    try {
        initSecurityProperties(jobExecutionContext);
        JobSubmissionInterface preferredJobSubmissionInterface = jobExecutionContext.getPreferredJobSubmissionInterface();
        JobSubmissionProtocol protocol = preferredJobSubmissionInterface.getJobSubmissionProtocol();
        String interfaceId = preferredJobSubmissionInterface.getJobSubmissionInterfaceId();
        String factoryUrl = null;
        if (protocol.equals(JobSubmissionProtocol.UNICORE)) {
            UnicoreJobSubmission unicoreJobSubmission = GFacUtils.getUnicoreJobSubmission(interfaceId);
            factoryUrl = unicoreJobSubmission.getUnicoreEndPointURL();
        }
        storageClient = null;
        if (!isSMSInstanceExisting(jobExecutionContext)) {
            EndpointReferenceType eprt = EndpointReferenceType.Factory.newInstance();
            eprt.addNewAddress().setStringValue(factoryUrl);
            StorageCreator storageCreator = new StorageCreator(secProperties, factoryUrl, 5, null);
            try {
                storageClient = storageCreator.createStorage();
            } catch (Exception e2) {
                log.error("Cannot create storage..");
                throw new GFacHandlerException("Cannot create storage..", e2);
            }
            jobExecutionContext.setProperty(PROP_SMS_EPR, storageClient.getEPR());
        } else {
            EndpointReferenceType eprt = (EndpointReferenceType) jobExecutionContext.getProperty(PROP_SMS_EPR);
            try {
                storageClient = new StorageClient(eprt, secProperties);
            } catch (Exception e) {
                throw new GFacHandlerException("Cannot create storage..", e);
            }
        }
        dataTransferrer = new DataTransferrer(jobExecutionContext, storageClient);
    } catch (AppCatalogException e) {
        throw new GFacHandlerException("Error occurred while retrieving unicore job submission interface..", e);
    }
}
Also used : AppCatalogException(org.apache.airavata.registry.cpi.AppCatalogException) EndpointReferenceType(org.w3.x2005.x08.addressing.EndpointReferenceType) DataTransferrer(org.apache.airavata.gfac.bes.utils.DataTransferrer) StorageClient(de.fzj.unicore.uas.client.StorageClient) StorageCreator(org.apache.airavata.gfac.bes.utils.StorageCreator) AppCatalogException(org.apache.airavata.registry.cpi.AppCatalogException) GFacException(org.apache.airavata.gfac.core.GFacException) GFacHandlerException(org.apache.airavata.gfac.core.handler.GFacHandlerException) GFacHandlerException(org.apache.airavata.gfac.core.handler.GFacHandlerException)

Example 7 with AppCatalogException

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

the class ComputeAppCatalogExperimentCatResourceTest method setUp.

@Before
public void setUp() {
    try {
        initialize = new Initialize("appcatalog-derby.sql");
        initialize.initializeDB();
        appcatalog = RegistryFactory.getAppCatalog();
    } catch (AppCatalogException e) {
        logger.error(e.getMessage(), e);
    }
}
Also used : AppCatalogException(org.apache.airavata.registry.cpi.AppCatalogException) Initialize(org.apache.airavata.app.catalog.util.Initialize) Before(org.junit.Before)

Example 8 with AppCatalogException

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

the class GatewayProfileTest method setUp.

@Before
public void setUp() {
    try {
        initialize = new Initialize("appcatalog-derby.sql");
        initialize.initializeDB();
        appcatalog = RegistryFactory.getAppCatalog();
    } catch (AppCatalogException e) {
        logger.error(e.getMessage(), e);
    }
}
Also used : AppCatalogException(org.apache.airavata.registry.cpi.AppCatalogException) Initialize(org.apache.airavata.app.catalog.util.Initialize) Before(org.junit.Before)

Example 9 with AppCatalogException

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

the class StorageResourceAppCatalogTest method testAddStorageResource.

@Test
public void testAddStorageResource() {
    try {
        StorageResource storageResource = appcatalog.getStorageResource();
        StorageResourceDescription description = new StorageResourceDescription();
        description.setHostName("localhost");
        description.setEnabled(true);
        description.setStorageResourceDescription("testDescription");
        String scpDataMoveId = addSCPDataMovement();
        System.out.println("**** SCP DataMoveId****** :" + scpDataMoveId);
        String gridFTPDataMoveId = addGridFTPDataMovement();
        System.out.println("**** grid FTP DataMoveId****** :" + gridFTPDataMoveId);
        List<DataMovementInterface> dataMovementInterfaces = new ArrayList<DataMovementInterface>();
        DataMovementInterface scpInterface = new DataMovementInterface();
        scpInterface.setDataMovementInterfaceId(scpDataMoveId);
        scpInterface.setDataMovementProtocol(DataMovementProtocol.SCP);
        scpInterface.setPriorityOrder(1);
        DataMovementInterface gridFTPMv = new DataMovementInterface();
        gridFTPMv.setDataMovementInterfaceId(gridFTPDataMoveId);
        gridFTPMv.setDataMovementProtocol(DataMovementProtocol.GridFTP);
        gridFTPMv.setPriorityOrder(2);
        dataMovementInterfaces.add(scpInterface);
        dataMovementInterfaces.add(gridFTPMv);
        description.setDataMovementInterfaces(dataMovementInterfaces);
        String resourceId = storageResource.addStorageResource(description);
        System.out.println("**********Resource id ************* : " + resourceId);
        StorageResourceDescription storageResourceDescription = null;
        if (storageResource.isStorageResourceExists(resourceId)) {
            storageResourceDescription = storageResource.getStorageResource(resourceId);
            List<DataMovementInterface> movementInterfaces = storageResourceDescription.getDataMovementInterfaces();
            if (movementInterfaces != null && !movementInterfaces.isEmpty()) {
                for (DataMovementInterface dataMovementInterface : movementInterfaces) {
                    System.out.println("Data Movement Interface Id :" + dataMovementInterface.getDataMovementInterfaceId());
                    System.out.println("Data Movement Protocol :" + dataMovementInterface.getDataMovementProtocol().toString());
                }
            }
        }
        description.setHostName("localhost2");
        storageResource.updateStorageResource(resourceId, description);
        if (storageResource.isStorageResourceExists(resourceId)) {
            storageResourceDescription = storageResource.getStorageResource(resourceId);
            System.out.println("**********Updated Resource name ************* : " + storageResourceDescription.getHostName());
        }
        assertTrue("Compute resource save successfully", storageResourceDescription != null);
    } catch (AppCatalogException e) {
        logger.error(e.getMessage(), e);
    }
}
Also used : StorageResource(org.apache.airavata.registry.cpi.StorageResource) AppCatalogException(org.apache.airavata.registry.cpi.AppCatalogException) StorageResourceDescription(org.apache.airavata.model.appcatalog.storageresource.StorageResourceDescription) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 10 with AppCatalogException

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

the class AppInterfaceTest method setUp.

@Before
public void setUp() {
    try {
        initialize = new Initialize("appcatalog-derby.sql");
        initialize.initializeDB();
        appcatalog = RegistryFactory.getAppCatalog();
    } catch (AppCatalogException e) {
        logger.error(e.getMessage(), e);
    }
}
Also used : AppCatalogException(org.apache.airavata.registry.cpi.AppCatalogException) Initialize(org.apache.airavata.app.catalog.util.Initialize) Before(org.junit.Before)

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