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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
Aggregations