Package org.airavata.appcatalog.cpi

Examples of org.airavata.appcatalog.cpi.ComputeResource


     */
    @Override
    public boolean addLocalSubmissionDetails(String computeResourceId, int priorityOrder, LOCALSubmission localSubmission) throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
      try {
            appCatalog = AppCatalogFactory.getAppCatalog();
            ComputeResource computeResource = appCatalog.getComputeResource();
            addJobSubmissionInterface(computeResource, computeResourceId,
                computeResource.addLocalJobSubmission(localSubmission), JobSubmissionProtocol.LOCAL, priorityOrder);
            return true;
        } catch (AppCatalogException e) {
            logger.error("Error while adding job submission interface to resource compute resource...", e);
            AiravataSystemException exception = new AiravataSystemException();
            exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
View Full Code Here


     */
    @Override
    public boolean addSSHJobSubmissionDetails(String computeResourceId, int priorityOrder, SSHJobSubmission sshJobSubmission) throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
      try {
            appCatalog = AppCatalogFactory.getAppCatalog();
            ComputeResource computeResource = appCatalog.getComputeResource();
            addJobSubmissionInterface(computeResource, computeResourceId,
                computeResource.addSSHJobSubmission(sshJobSubmission), JobSubmissionProtocol.SSH, priorityOrder);
            return true;
        } catch (AppCatalogException e) {
            logger.error("Error while adding job submission interface to resource compute resource...", e);
            AiravataSystemException exception = new AiravataSystemException();
            exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
View Full Code Here

     */
    @Override
    public boolean addLocalDataMovementDetails(String computeResourceId, int priorityOrder, LOCALDataMovement localDataMovement) throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
      try {
            appCatalog = AppCatalogFactory.getAppCatalog();
            ComputeResource computeResource = appCatalog.getComputeResource();
            addDataMovementInterface(computeResource, computeResourceId,
                computeResource.addLocalDataMovement(localDataMovement), DataMovementProtocol.LOCAL, priorityOrder);
            return true;
        } catch (AppCatalogException e) {
            logger.error("Error while adding data movement interface to resource compute resource...", e);
            AiravataSystemException exception = new AiravataSystemException();
            exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
View Full Code Here

     */
    @Override
    public boolean addSCPDataMovementDetails(String computeResourceId, int priorityOrder, SCPDataMovement scpDataMovement) throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
      try {
            appCatalog = AppCatalogFactory.getAppCatalog();
            ComputeResource computeResource = appCatalog.getComputeResource();
            addDataMovementInterface(computeResource, computeResourceId,
                computeResource.addScpDataMovement(scpDataMovement), DataMovementProtocol.SCP, priorityOrder);
            return true;
        } catch (AppCatalogException e) {
            logger.error("Error while adding data movement interface to resource compute resource...", e);
            AiravataSystemException exception = new AiravataSystemException();
            exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
View Full Code Here

     */
    @Override
    public boolean addGridFTPDataMovementDetails(String computeResourceId, int priorityOrder, GridFTPDataMovement gridFTPDataMovement) throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
      try {
            appCatalog = AppCatalogFactory.getAppCatalog();
            ComputeResource computeResource = appCatalog.getComputeResource();
            addDataMovementInterface(computeResource, computeResourceId,
                computeResource.addGridFTPDataMovement(gridFTPDataMovement), DataMovementProtocol.GridFTP, priorityOrder);
            return true;
        } catch (AppCatalogException e) {
            logger.error("Error while adding data movement interface to resource compute resource...", e);
            AiravataSystemException exception = new AiravataSystemException();
            exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
View Full Code Here

    @Override
    public ComputeResourcePreference getGatewayComputeResourcePreference(String gatewayID, String computeResourceId) throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
      try {
            appCatalog = AppCatalogFactory.getAppCatalog();
            GwyResourceProfile gatewayProfile = appCatalog.getGatewayProfile();
            ComputeResource computeResource = appCatalog.getComputeResource();
            if (!gatewayProfile.isGatewayResourceProfileExists(gatewayID)){
                logger.error("Given gateway profile does not exist in the system. Please provide a valid gateway id...");
                AiravataSystemException exception = new AiravataSystemException();
                exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
                exception.setMessage("Given gateway profile does not exist in the system. Please provide a valid gateway id...");
                throw exception;
            }
            if (!computeResource.isComputeResourceExists(computeResourceId)){
                logger.error("Given compute resource does not exist in the system. Please provide a valid compute resource id...");
                AiravataSystemException exception = new AiravataSystemException();
                exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
                exception.setMessage("Given compute resource does not exist in the system. Please provide a valid compute resource id...");
                throw exception;
View Full Code Here

    @Test
    public void testAppDeployment () throws Exception {
        ApplicationDeployment appDep = appcatalog.getApplicationDeployment();
        ApplicationInterface appInt = appcatalog.getApplicationInterface();
        ComputeResource computeRs = appcatalog.getComputeResource();
        ComputeResourceDescription cm = new ComputeResourceDescription();
        cm.setHostName("localhost");
        cm.setResourceDescription("test compute host");
        String hostId = computeRs.addComputeResource(cm);

        ApplicationModule module = new ApplicationModule();
        module.setAppModuleName("WRF");
        module.setAppModuleVersion("1.0.0");
        String wrfModuleId = appInt.addApplicationModule(module);
View Full Code Here

    }

    @Test
    public void testAddComputeResource (){
        try {
            ComputeResource computeResource = appcatalog.getComputeResource();
            ComputeResourceDescription description = new ComputeResourceDescription();

            description.setHostName("localhost");
            description.setResourceDescription("test compute resource");
            Set<String> ipdaresses = new HashSet<String>();
            ipdaresses.add("222.33.43.444");
            ipdaresses.add("23.344.44.454");
            description.setIpAddresses(ipdaresses);
            Set<String> aliases = new HashSet<String>();
            aliases.add("test.alias1");
            aliases.add("test.alias2");
            description.setHostAliases(aliases);
            String sshsubmissionId = addSSHJobSubmission();
            System.out.println("**** SSH Submission id ****** :" + sshsubmissionId);
//            String gsiSSHsubmissionId = addGSISSHJobSubmission();
//            System.out.println("**** GSISSH Submission id ****** :" + gsiSSHsubmissionId);
//            String globusSubmissionId = addGlobusJobSubmission();
//            System.out.println("**** Globus Submission id ****** :" + globusSubmissionId);
            JobSubmissionInterface sshSubmissionInt = new JobSubmissionInterface();
            sshSubmissionInt.setJobSubmissionInterfaceId(sshsubmissionId);
            sshSubmissionInt.setPriorityOrder(1);
            sshSubmissionInt.setJobSubmissionProtocol(JobSubmissionProtocol.SSH);
            JobSubmissionInterface globusSubInt = new JobSubmissionInterface();
//            globusSubInt.setJobSubmissionInterfaceId(globusSubmissionId);
            globusSubInt.setPriorityOrder(2);
            globusSubInt.setJobSubmissionProtocol(JobSubmissionProtocol.GLOBUS);
            List<JobSubmissionInterface> interfaceList = new ArrayList<JobSubmissionInterface>();
            interfaceList.add(sshSubmissionInt);
            interfaceList.add(globusSubInt);
            description.setJobSubmissionInterfaces(interfaceList);

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

            description.setDataMovementInterfaces(dataMovementInterfaces);

            BatchQueue batchQueue1 = new BatchQueue();
            batchQueue1.setQueueName("queue1");
            batchQueue1.setQueueDescription("que1Desc1");
            batchQueue1.setMaxRunTime(10);
            batchQueue1.setMaxNodes(4);
            batchQueue1.setMaxJobsInQueue(1);

            BatchQueue batchQueue2 = new BatchQueue();
            batchQueue2.setQueueName("queue2");
            batchQueue2.setQueueDescription("que1Desc2");
            batchQueue2.setMaxRunTime(10);
            batchQueue2.setMaxNodes(4);
            batchQueue2.setMaxJobsInQueue(1);

            List<BatchQueue> batchQueueList = new ArrayList<BatchQueue>();
            batchQueueList.add(batchQueue1);
            batchQueueList.add(batchQueue2);
            description.setBatchQueues(batchQueueList);

            Map<FileSystems, String> fileSysMap = new HashMap<FileSystems, String>();
            fileSysMap.put(FileSystems.HOME, "/home");
            fileSysMap.put(FileSystems.SCRATCH, "/tmp");
            description.setFileSystems(fileSysMap);

            String resourceId = computeResource.addComputeResource(description);
            System.out.println("**********Resource id ************* : " +  resourceId);
            ComputeResourceDescription host = null;
            if (computeResource.isComputeResourceExists(resourceId)){
                host = computeResource.getComputeResource(resourceId);
                System.out.println("**********Resource name ************* : " +  host.getHostName());
            }

            SSHJobSubmission sshJobSubmission = computeResource.getSSHJobSubmission(sshsubmissionId);
            System.out.println("**********SSH Submission resource job manager ************* : " +  sshJobSubmission.getResourceJobManager().toString());

//            GlobusJobSubmission globusJobSubmission = computeResource.get(globusSubmissionId);
//            System.out.println("**********Globus Submission resource job manager ************* : " + globusJobSubmission.getResourceJobManager().toString());

            SCPDataMovement scpDataMovement = computeResource.getSCPDataMovement(scpDataMoveId);
            System.out.println("**********SCP Data Move Security protocol ************* : " + scpDataMovement.getSecurityProtocol().toString());

            GridFTPDataMovement gridFTPDataMovement = computeResource.getGridFTPDataMovement(gridFTPDataMoveId);
            System.out.println("**********GRID FTP Data Move Security protocol ************* : " + gridFTPDataMovement.getSecurityProtocol().toString());

            description.setHostName("localhost2");
            computeResource.updateComputeResource(resourceId, description);
            if (computeResource.isComputeResourceExists(resourceId)){
                host = computeResource.getComputeResource(resourceId);
                System.out.println("**********Updated Resource name ************* : " +  host.getHostName());
            }

            Map<String, String> cfilters = new HashMap<String, String>();
            cfilters.put(AbstractResource.ComputeResourceConstants.HOST_NAME, "localhost2");
            List<ComputeResourceDescription> computeResourceList = computeResource.getComputeResourceList(cfilters);
            System.out.println("**********Size of compute resources ************* : " +  computeResourceList.size());

            List<ComputeResourceDescription> allComputeResourceList = computeResource.getAllComputeResourceList();
            System.out.println("**********Size of all compute resources ************* : " +  allComputeResourceList.size());

            Map<String, String> allComputeResourceIdList = computeResource.getAllComputeResourceIdList();
            System.out.println("**********Size of all compute resources ids ************* : " +  allComputeResourceIdList.size());

//            Map<String, String> globusfilters = new HashMap<String, String>();
//            globusfilters.put(AbstractResource.GlobusJobSubmissionConstants.RESOURCE_JOB_MANAGER, ResourceJobManager.PBS.toString());
//            List<GlobusJobSubmission> gList = computeResource.getGlobusJobSubmissionList(globusfilters);
View Full Code Here

    public void gatewayProfileTest() throws Exception {
        GwyResourceProfile gatewayProfile = appcatalog.getGatewayProfile();
        GatewayResourceProfile gf = new GatewayResourceProfile();
        gf.setGatewayName("test");
        gf.setGatewayDescription("test gateway");
        ComputeResource computeRs = appcatalog.getComputeResource();
        ComputeResourceDescription cm1 = new ComputeResourceDescription();
        cm1.setHostName("localhost");
        cm1.setResourceDescription("test compute host");
        String hostId1 = computeRs.addComputeResource(cm1);

        ComputeResourceDescription cm2 = new ComputeResourceDescription();
        cm2.setHostName("localhost");
        cm2.setResourceDescription("test compute host");
        String hostId2 = computeRs.addComputeResource(cm2);

        ComputeResourcePreference preference1 = new ComputeResourcePreference();
        preference1.setComputeResourceId(hostId1);
        preference1.setOverridebyAiravata(true);
        preference1.setPreferredJobSubmissionProtocol(JobSubmissionProtocol.SSH.toString());
View Full Code Here

    if (taskData.getTaskScheduling().getResourceHostId() != null) {
        moduleIdFilter.put(AbstractResource.ApplicationDeploymentConstants.COMPUTE_HOST_ID, taskData.getTaskScheduling().getResourceHostId());
    }
    List<ApplicationDeploymentDescription> applicationDeployements = appCatalog.getApplicationDeployment().getApplicationDeployements(moduleIdFilter);
    Map<ComputeResourceDescription, ApplicationDeploymentDescription> deploymentMap = new HashMap<ComputeResourceDescription, ApplicationDeploymentDescription>();
    ComputeResource computeResource = appCatalog.getComputeResource();
    for (ApplicationDeploymentDescription deploymentDescription : applicationDeployements) {
      deploymentMap.put(computeResource.getComputeResource(deploymentDescription.getComputeHostId()),deploymentDescription);
    }
    List<ComputeResourceDescription> computeHostList = Arrays.asList(deploymentMap.keySet().toArray(new ComputeResourceDescription[]{}))
    Class<? extends HostScheduler> aClass = Class.forName(
        ServerSettings.getHostScheduler()).asSubclass(
        HostScheduler.class);
View Full Code Here

TOP

Related Classes of org.airavata.appcatalog.cpi.ComputeResource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.