Package org.apache.airavata.commons.gfac.type

Examples of org.apache.airavata.commons.gfac.type.HostDescription


    }
   
    private void editDescriptor() throws AiravataAPIInvocationException {
      switch (descriptorType){
        case HOST:
          HostDescription h = (HostDescription) getSelected();
          HostDescriptionDialog hostDescriptionDialog = new HostDescriptionDialog(engine.getConfiguration().getAiravataAPI(),false,h, null);
          hostDescriptionDialog.setLocationRelativeTo(this.engine.getGUI().getFrame());
          hostDescriptionDialog.open();
          if (hostDescriptionDialog.isHostCreated()) {
          loadDescriptors();
View Full Code Here


    private boolean deleteDescriptor() throws AiravataAPIInvocationException{
      String title=null;
      String question=null;
      switch (descriptorType){
        case HOST:
          HostDescription h = (HostDescription) getSelected();
          title = "Host description";
          question = "Are you sure that you want to remove the service description \""
                      + h.getType().getHostName() + "\"?";
          break;
        case SERVICE:
            ServiceDescription d = (ServiceDescription) getSelected();
          title = "Service description";
          question = "Are you sure that you want to remove the applications associated with \""
                      + d.getType().getName() + "\"?";
          break;
        case APPLICATION:
          ApplicationDescription a = (ApplicationDescription) getSelected();
          title = "Service description";
          question = "Are you sure that you want to remove the service description \""
                      + a.getType().getApplicationName().getStringValue() + "\"?";
          break;
      }
     
       
    if (askQuestion(title, question)) {
              switch (descriptorType){
              case HOST:
                HostDescription h = (HostDescription) getSelected();
                  getAPI().getApplicationManager().deleteHostDescription(h.getType().getHostName());
                        loadDescriptors();
                break;
              case SERVICE:
                  ServiceDescription d = (ServiceDescription) getSelected();
                  getAPI().getApplicationManager().deleteServiceDescription(d.getType().getName());
View Full Code Here

        airavataAPI = AiravataAPIFactory.getAPI(new URI(getRegistryURL()), getGatewayName(), getUserName(),
                passwordCallback);

        // Now creating documents to be saved in to registry using above created airavata client object//

        HostDescription descriptor = new HostDescription();
        descriptor.getType().setHostName("localhost");
        descriptor.getType().setHostAddress("127.0.0.1");

        log.info("Saving host description ....");
        airavataAPI.getApplicationManager().saveHostDescription(descriptor);

        ServiceDescription serviceDescription = new ServiceDescription();
View Full Code Here

    }

    public void setHostName(String hostName) {
        this.hostName = hostName;
        if (hostName!=null) {
      HostDescription hostDescription;
      try {
        hostDescription = registry.getApplicationManager().getHostDescription(hostName);
        if (hostDescription.getType() instanceof GlobusHostType) {
          getShellApplicationDescription().getType().changeType(
                  HpcApplicationDeploymentType.type);
        } else {
          getShellApplicationDescription().getType().changeType(
              ApplicationDeploymentDescriptionType.type);
        }
        btnHostAdvanceOptions.setVisible(hostDescription.getType() instanceof GlobusHostType);
        String hostAddress = hostDescription.getType().getHostAddress();
        boolean isLocal = isLocalAddress(hostAddress);
        btnExecBrowse.setVisible(isLocal);
        btnTmpDirBrowse.setVisible(isLocal);
       
      } catch (AiravataAPIInvocationException e) {
View Full Code Here

    }

    public void setHostName(String hostName) {
        this.hostName = hostName;
        if (hostName != null) {
            HostDescription hostDescription;
            try {
        hostDescription = registry.getApplicationManager().getHostDescription(hostName);
        if (hostDescription.getType() instanceof GlobusHostType) {
            getShellApplicationDescription().getType().changeType(
                            HpcApplicationDeploymentType.type);
        } else {
            getShellApplicationDescription().getType().changeType(
                    ApplicationDeploymentDescriptionType.type);
        }
        btnHostAdvanceOptions.setVisible(hostDescription.getType() instanceof GlobusHostType);
        String hostAddress = hostDescription.getType().getHostAddress();
        boolean isLocal = isLocalAddress(hostAddress);
        btnExecBrowse.setVisible(isLocal);
        btnTmpDirBrowse.setVisible(isLocal);
      catch (AiravataAPIInvocationException e) {
                e.printStackTrace();
View Full Code Here

        // Host
        URL url = this.getClass().getClassLoader().getResource(GRAM_PROPERTIES);
        Properties properties = new Properties();
        properties.load(url.openStream());
        HostDescription host = new HostDescription();
        host.getType().changeType(GlobusHostType.type);
        host.getType().setHostName(properties.getProperty("host.commom.name"));
        host.getType().setHostAddress(properties.getProperty("host.fqdn.name"));
        ((GlobusHostType) host.getType()).setGridFTPEndPointArray(new String[]{properties.getProperty("gridftp.endpoint")});
        ((GlobusHostType) host.getType()).setGlobusGateKeeperEndPointArray(new String[]{properties.getProperty("gram.endpoints")});

        /* Application */
        ApplicationDescription appDesc = new ApplicationDescription(HpcApplicationDeploymentType.type);
        HpcApplicationDeploymentType app = (HpcApplicationDeploymentType) appDesc.getType();
        app.setCpuCount(1);
        app.setNodeCount(1);
        ApplicationDeploymentDescriptionType.ApplicationName name = appDesc.getType().addNewApplicationName();
        name.setStringValue("EchoMPILocal");
        app.setExecutableLocation("/share/home/01437/ogce/airavata-test/mpi-hellow-world");
        app.setScratchWorkingDirectory(properties.getProperty("scratch.working.directory"));
        app.setCpuCount(16);
        app.setJobType(JobTypeType.MPI);
        //app.setMinMemory();
        ProjectAccountType projectAccountType = ((HpcApplicationDeploymentType) appDesc.getType()).addNewProjectAccount();
        projectAccountType.setProjectAccountNumber(properties.getProperty("allocation.charge.number"));

        /* Service */
        ServiceDescription serv = new ServiceDescription();
        serv.getType().setName("SimpleMPIEcho");

        InputParameterType input = InputParameterType.Factory.newInstance();
        ParameterType parameterType = input.addNewParameterType();
        parameterType.setName("echo_mpi_input");
        List<InputParameterType> inputList = new ArrayList<InputParameterType>();
        inputList.add(input);
        InputParameterType[] inputParamList = inputList.toArray(new InputParameterType[inputList
                .size()]);

        OutputParameterType output = OutputParameterType.Factory.newInstance();
        ParameterType parameterType1 = output.addNewParameterType();
        parameterType1.setName("echo_mpi_output");
        List<OutputParameterType> outputList = new ArrayList<OutputParameterType>();
        outputList.add(output);
        OutputParameterType[] outputParamList = outputList
                .toArray(new OutputParameterType[outputList.size()]);
        serv.getType().setInputParametersArray(inputParamList);
        serv.getType().setOutputParametersArray(outputParamList);

        /* Save to Registry */
        airavataAPI.getApplicationManager().saveHostDescription(host);
        airavataAPI.getApplicationManager().saveApplicationDescription(serv.getType().getName(), host.getType().getHostName(), appDesc);
        airavataAPI.getApplicationManager().saveServiceDescription(serv);
//        jcrRegistry.deployServiceOnHost(serv.getType().getName(), host.getType().getHostName());
    }
View Full Code Here

           */

        URL url = this.getClass().getClassLoader().getResource(GRAM_PROPERTIES);
        Properties properties = new Properties();
        properties.load(url.openStream());
        HostDescription host = new HostDescription();
        host.getType().changeType(GlobusHostType.type);
        host.getType().setHostName(properties.getProperty("host.commom.name"));
        host.getType().setHostAddress(properties.getProperty("host.fqdn.name"));
        ((GlobusHostType) host.getType()).setGridFTPEndPointArray(new String[]{properties.getProperty("gridftp.endpoint")});
        ((GlobusHostType) host.getType()).setGlobusGateKeeperEndPointArray(new String[]{properties.getProperty("gram.endpoints")});


        /*
        * App
        */
        ApplicationDescription appDesc = new ApplicationDescription(HpcApplicationDeploymentType.type);
        HpcApplicationDeploymentType app = (HpcApplicationDeploymentType) appDesc.getType();
        app.setCpuCount(1);
        app.setNodeCount(1);
        ApplicationDeploymentDescriptionType.ApplicationName name = appDesc.getType().addNewApplicationName();
        name.setStringValue("EchoLocal");
        app.setExecutableLocation("/bin/echo");
        app.setScratchWorkingDirectory(properties.getProperty("scratch.working.directory"));
        app.setCpuCount(1);
        ProjectAccountType projectAccountType = ((HpcApplicationDeploymentType) appDesc.getType()).addNewProjectAccount();
        projectAccountType.setProjectAccountNumber(properties.getProperty("allocation.charge.number"));
        QueueType queueType = app.addNewQueue();
        queueType.setQueueName(properties.getProperty("defualt.queue"));
        app.setMaxMemory(100);
       
        /*
           * Service
           */
        ServiceDescription serv = new ServiceDescription();
        serv.getType().setName("SimpleEcho");

        InputParameterType input = InputParameterType.Factory.newInstance();
        ParameterType parameterType = input.addNewParameterType();
        parameterType.setName("echo_input");
        List<InputParameterType> inputList = new ArrayList<InputParameterType>();
        inputList.add(input);
        InputParameterType[] inputParamList = inputList.toArray(new InputParameterType[inputList
                .size()]);

        OutputParameterType output = OutputParameterType.Factory.newInstance();
        ParameterType parameterType1 = output.addNewParameterType();
        parameterType1.setName("echo_output");
        List<OutputParameterType> outputList = new ArrayList<OutputParameterType>();
        outputList.add(output);
        OutputParameterType[] outputParamList = outputList
                .toArray(new OutputParameterType[outputList.size()]);
        serv.getType().setInputParametersArray(inputParamList);
        serv.getType().setOutputParametersArray(outputParamList);

        /*
           * Save to registry
           */

        airavataAPI.getApplicationManager().getApplicationDescriptors(serv.getType().getName());

        if(airavataAPI.getApplicationManager().isHostDescriptorExists(host.getType().getHostName())) {
            airavataAPI.getApplicationManager().updateHostDescriptor(host);
        } else {
            airavataAPI.getApplicationManager().saveHostDescription(host);
        }

        if (airavataAPI.getApplicationManager().isApplicationDescriptorExists(serv.getType().getName(), host.getType().getHostName(), appDesc.getType().getApplicationName().getStringValue())){
            airavataAPI.getApplicationManager().updateApplicationDescriptor(serv.getType().getName(), host.getType().getHostName(), appDesc);
        } else {
            airavataAPI.getApplicationManager().saveApplicationDescription(serv.getType().getName(), host.getType().getHostName(), appDesc);
        }

        if (airavataAPI.getApplicationManager().isServiceDescriptorExists(serv.getType().getName())){
            airavataAPI.getApplicationManager().updateServiceDescriptor(serv);
        } else {
View Full Code Here

        registry.unsetMessageBoxURI();
        assertNotNull("message url removed successfully", ResourceUtils.isConfigurationExist("messagebox.url"));
    }

    public void testIsHostDescriptorExists() throws Exception {
        HostDescription descriptor = new HostDescription(GlobusHostType.type);
        descriptor.getType().setHostName("testHost");
        descriptor.getType().setHostAddress("testHostAddress");
        registry.addHostDescriptor(descriptor);
        assertTrue("Host added successfully", registry.isHostDescriptorExists("testHost"));
        registry.removeHostDescriptor("testHost");
    }
View Full Code Here

        registry.removeHostDescriptor("testHost");
    }


    public void testAddHostDescriptor() throws Exception {
        HostDescription descriptor = new HostDescription(GlobusHostType.type);
        descriptor.getType().setHostName("testHost");
        descriptor.getType().setHostAddress("testHostAddress");
        registry.addHostDescriptor(descriptor);
        assertTrue("Host added successfully", registry.isHostDescriptorExists("testHost"));
        registry.removeHostDescriptor("testHost");
    }
View Full Code Here

        // Host
        URL url = this.getClass().getClassLoader().getResource(GRAM_PROPERTIES);
        Properties properties = new Properties();
        properties.load(url.openStream());
        HostDescription host = new HostDescription();
        host.getType().changeType(GlobusHostType.type);
        host.getType().setHostName(properties.getProperty("host.commom.name"));
        host.getType().setHostAddress(properties.getProperty("host.fqdn.name"));
        ((GlobusHostType) host.getType()).setGridFTPEndPointArray(new String[]{properties.getProperty("gridftp.endpoint")});
        ((GlobusHostType) host.getType()).setGlobusGateKeeperEndPointArray(new String[]{properties.getProperty("gram.endpoints")});

        /* Application */
        ApplicationDescription appDesc = new ApplicationDescription(HpcApplicationDeploymentType.type);
        HpcApplicationDeploymentType app = (HpcApplicationDeploymentType) appDesc.getType();
        app.setNodeCount(1);
        ApplicationDeploymentDescriptionType.ApplicationName name = appDesc.getType().addNewApplicationName();
        name.setStringValue("MockPwscfMPI");
        app.setExecutableLocation("/share/home/01437/ogce/airavata-test/applications/MockPwscf/pwscf.w");
        app.setScratchWorkingDirectory(properties.getProperty("scratch.working.directory"));
        app.setStaticWorkingDirectory("/share/home/01437/ogce/airavata-test/applications/MockPwscf");
        app.setCpuCount(4);
        app.setJobType(JobTypeType.MPI);
        app.setMaxWallTime(9);
        ProjectAccountType projectAccountType = ((HpcApplicationDeploymentType) appDesc.getType()).addNewProjectAccount();
        projectAccountType.setProjectAccountNumber(properties.getProperty("allocation.charge.number"));

        /* Service */
        ServiceDescription serv = new ServiceDescription();
        serv.getType().setName("MockPwscfMPIService");

        InputParameterType input = InputParameterType.Factory.newInstance();
        ParameterType parameterType = input.addNewParameterType();
        parameterType.setName("echo_mpi_input");
        List<InputParameterType> inputList = new ArrayList<InputParameterType>();
        inputList.add(input);
        InputParameterType[] inputParamList = inputList.toArray(new InputParameterType[inputList
                .size()]);

        OutputParameterType output = OutputParameterType.Factory.newInstance();
        ParameterType parameterType1 = output.addNewParameterType();
        parameterType1.setName("echo_mpi_output");
        List<OutputParameterType> outputList = new ArrayList<OutputParameterType>();
        outputList.add(output);
        OutputParameterType[] outputParamList = outputList
                .toArray(new OutputParameterType[outputList.size()]);
        serv.getType().setInputParametersArray(inputParamList);
        serv.getType().setOutputParametersArray(outputParamList);

        /* Save to Registry */
        airavataAPI.getApplicationManager().saveHostDescription(host);
        airavataAPI.getApplicationManager().saveApplicationDescription(serv.getType().getName(), host.getType().getHostName(), appDesc);
        airavataAPI.getApplicationManager().saveServiceDescription(serv);
//        jcrRegistry.deployServiceOnHost(serv.getType().getName(), host.getType().getHostName());
    }
View Full Code Here

TOP

Related Classes of org.apache.airavata.commons.gfac.type.HostDescription

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.