Search in sources :

Example 1 with DataMovementInterface

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();
    }
}
Also used : TException(org.apache.thrift.TException) AuthzToken(org.apache.airavata.model.security.AuthzToken) DataMovementInterface(org.apache.airavata.model.data.movement.DataMovementInterface)

Example 2 with DataMovementInterface

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;
}
Also used : DataMovementInterface(org.apache.airavata.model.data.movement.DataMovementInterface)

Example 3 with 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();
        }
    }
}
Also used : DataMovementInterface(org.apache.airavata.model.data.movement.DataMovementInterface) StorageInterfaceResource(org.apache.airavata.registry.core.app.catalog.resources.StorageInterfaceResource)

Example 4 with DataMovementInterface

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;
}
Also used : SCPDataMovement(org.apache.airavata.model.data.movement.SCPDataMovement) DataMovementProtocol(org.apache.airavata.model.data.movement.DataMovementProtocol) DataMovementInterface(org.apache.airavata.model.data.movement.DataMovementInterface)

Example 5 with DataMovementInterface

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;
}
Also used : UserComputeResourcePreference(org.apache.airavata.model.appcatalog.userresourceprofile.UserComputeResourcePreference) ComputeResourcePreference(org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference) DataMovementProtocol(org.apache.airavata.model.data.movement.DataMovementProtocol) DataMovementInterface(org.apache.airavata.model.data.movement.DataMovementInterface)

Aggregations

DataMovementInterface (org.apache.airavata.model.data.movement.DataMovementInterface)5 DataMovementProtocol (org.apache.airavata.model.data.movement.DataMovementProtocol)2 ComputeResourcePreference (org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference)1 UserComputeResourcePreference (org.apache.airavata.model.appcatalog.userresourceprofile.UserComputeResourcePreference)1 SCPDataMovement (org.apache.airavata.model.data.movement.SCPDataMovement)1 AuthzToken (org.apache.airavata.model.security.AuthzToken)1 StorageInterfaceResource (org.apache.airavata.registry.core.app.catalog.resources.StorageInterfaceResource)1 TException (org.apache.thrift.TException)1