use of org.apache.airavata.model.data.movement.DataMovementInterface in project airavata by apache.
the class SampleEchoExperiment method registerLocalhost.
private void registerLocalhost() {
try {
System.out.println("\n #### Registering Localhost Computational Resource #### \n");
ComputeResourceDescription computeResourceDescription = RegisterSampleApplicationsUtils.createComputeResourceDescription("localhost", "LocalHost", null, null);
DataMovementInterface dataMovementInterface = new DataMovementInterface("localhost_data_movement_interface", DataMovementProtocol.LOCAL, 1);
computeResourceDescription.addToDataMovementInterfaces(dataMovementInterface);
JobSubmissionInterface jobSubmissionInterface = new JobSubmissionInterface("localhost_job_submission_interface", JobSubmissionProtocol.LOCAL, 1);
computeResourceDescription.addToJobSubmissionInterfaces(jobSubmissionInterface);
localhostId = airavataClient.registerComputeResource(new AuthzToken(""), computeResourceDescription);
ResourceJobManager resourceJobManager = RegisterSampleApplicationsUtils.createResourceJobManager(ResourceJobManagerType.FORK, null, null, null);
LOCALSubmission submission = new LOCALSubmission();
submission.setResourceJobManager(resourceJobManager);
String localSubmission = airavataClient.addLocalSubmissionDetails(new AuthzToken(""), localhostId, 1, submission);
System.out.println(localSubmission);
System.out.println("LocalHost Resource Id is " + localhostId);
} catch (TException e) {
e.printStackTrace();
}
}
use of org.apache.airavata.model.data.movement.DataMovementInterface in project airavata by apache.
the class RegisterSampleApplicationsUtils method createDataMovementInterface.
public static DataMovementInterface createDataMovementInterface(String dataMovementInterfaceId, DataMovementProtocol dataMovementProtocolType, int priorityOrder) {
DataMovementInterface dataMovementInterface = new DataMovementInterface();
dataMovementInterface.setDataMovementInterfaceId(dataMovementInterfaceId);
dataMovementInterface.setDataMovementProtocol(dataMovementProtocolType);
dataMovementInterface.setPriorityOrder(priorityOrder);
return dataMovementInterface;
}
use of org.apache.airavata.model.data.movement.DataMovementInterface in project airavata by apache.
the class StorageResourceImpl method saveDataMovementInterfaces.
protected void saveDataMovementInterfaces(StorageResourceDescription description, StorageResourceResource storageResourceResource) throws AppCatalogException {
List<DataMovementInterface> dataMovemenetInterfaces = description.getDataMovementInterfaces();
if (dataMovemenetInterfaces != null && !dataMovemenetInterfaces.isEmpty()) {
for (DataMovementInterface dataMovementInterface : dataMovemenetInterfaces) {
StorageInterfaceResource storageInterface = AppCatalogThriftConversion.getStorageInterface(dataMovementInterface);
storageInterface.setStorageResourceResource(storageResourceResource);
storageInterface.setStorageResourceId(storageResourceResource.getStorageResourceId());
storageInterface.save();
}
}
}
use of org.apache.airavata.model.data.movement.DataMovementInterface in project airavata by apache.
the class OrchestratorUtils method getDataMovementPort.
public static int getDataMovementPort(OrchestratorContext context, ProcessModel processModel, String gatewayId) throws RegistryException {
try {
DataMovementProtocol protocol = getPreferredDataMovementProtocol(context, processModel, gatewayId);
DataMovementInterface dataMovementInterface = getPrefferredDataMovementInterface(context, processModel, gatewayId);
if (protocol == DataMovementProtocol.SCP) {
SCPDataMovement scpDataMovement = getSCPDataMovement(context, dataMovementInterface.getDataMovementInterfaceId());
if (scpDataMovement != null) {
return scpDataMovement.getSshPort();
}
}
} catch (RegistryException e) {
logger.error("Error occurred while retrieving security protocol", e);
}
return 0;
}
use of org.apache.airavata.model.data.movement.DataMovementInterface in project airavata by apache.
the class OrchestratorUtils method getPrefferredDataMovementInterface.
public static DataMovementInterface getPrefferredDataMovementInterface(OrchestratorContext context, ProcessModel processModel, String gatewayId) throws RegistryException {
try {
String resourceHostId = processModel.getComputeResourceId();
ComputeResourcePreference resourcePreference = getComputeResourcePreference(context, processModel, gatewayId);
DataMovementProtocol preferredDataMovementProtocol = resourcePreference.getPreferredDataMovementProtocol();
ComputeResourceDescription resourceDescription = context.getRegistry().getAppCatalog().getComputeResource().getComputeResource(resourceHostId);
List<DataMovementInterface> dataMovementInterfaces = resourceDescription.getDataMovementInterfaces();
if (dataMovementInterfaces != null && !dataMovementInterfaces.isEmpty()) {
for (DataMovementInterface dataMovementInterface : dataMovementInterfaces) {
if (preferredDataMovementProtocol != null) {
if (preferredDataMovementProtocol.toString().equals(dataMovementInterface.getDataMovementProtocol().toString())) {
return dataMovementInterface;
}
}
}
} else {
throw new RegistryException("Compute resource should have at least one data movement interface defined...");
}
} catch (AppCatalogException e) {
throw new RegistryException("Error occurred while retrieving data from app catalog", e);
}
return null;
}
Aggregations