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

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


            handleOutPath(jobExecutionContext);
        }
    }

    private void handleInPath(JobExecutionContext jobExecutionContext) throws GFacHandlerException {
        HostDescription hostDescription =
                jobExecutionContext.getApplicationContext().getHostDescription();
        if (!isHadoopDeploymentAvailable(hostDescription)) {
            // Temp directory to keep generated configuration files.
            File tempDirectory = Files.createTempDir();
            try {
                File hadoopSiteXML = launchHadoopCluster(hostDescription, tempDirectory);
                jobExecutionContext.getInMessageContext().addParameter("HADOOP_SITE_XML", hadoopSiteXML.getAbsolutePath());
                jobExecutionContext.getInMessageContext().addParameter("HADOOP_DEPLOYMENT_TYPE", "WHIRR");
                // TODO: Add hadoop-site.xml to job execution context.
            } catch (IOException e) {
                throw new GFacHandlerException("IO Error while processing configurations.",e);
            } catch (ConfigurationException e) {
                throw  new GFacHandlerException("Whirr configuration error.", e);
            } catch (InterruptedException e) {
                throw new GFacHandlerException("Hadoop cluster launch interrupted.", e);
            } catch (TransformerException e) {
                throw new GFacHandlerException("Error while creating hadoop-site.xml", e);
            } catch (ParserConfigurationException e) {
                throw new GFacHandlerException("Error while creating hadoop-site.xml", e);
            }
        } else {
            jobExecutionContext.getInMessageContext().addParameter("HADOOP_DEPLOYMENT_TYPE",
                    "MANUAL");
            jobExecutionContext.getInMessageContext().addParameter("HADOOP_CONFIG_DIR",
                    ((HadoopHostType)hostDescription.getType()).getHadoopConfigurationDirectory());
            logger.info("Hadoop configuration is available. Skipping hadoop deployment.");
            if(logger.isDebugEnabled()){
                logger.debug("Hadoop configuration directory: " +
                        getHadoopConfigDirectory(hostDescription));
            }
View Full Code Here


//        gFacConfiguration.setOutHandlers(Arrays.asList(new String[] {"org.apache.airavata.gfac.handler.GridFTPOutputHandler"}));

        /*
           * Host
           */
        HostDescription host = new HostDescription(GlobusHostType.type);
        host.getType().setHostAddress(hostAddress);
        host.getType().setHostName(hostName);
        ((GlobusHostType)host.getType()).setGlobusGateKeeperEndPointArray(new String[]{gramAddress});
        ((GlobusHostType)host.getType()).setGridFTPEndPointArray(new String[]{gridftpAddress});
        /*
           * App
           */
        ApplicationDescription appDesc = new ApplicationDescription(HpcApplicationDeploymentType.type);
        HpcApplicationDeploymentType app = (HpcApplicationDeploymentType)appDesc.getType();
View Full Code Here

     * Figure out which provider to use based on application configuration.
     * @param jobExecutionContext containing all the required configurations.
     * @return GFacProvider instance.
     */
    private static GFacProvider getProvider(JobExecutionContext jobExecutionContext){
        HostDescription hostDescription = jobExecutionContext.getApplicationContext().getHostDescription();
        if(hostDescription.getType() instanceof GlobusHostType){
            return new GramProvider();
        }
        else if (hostDescription.getType() instanceof UnicoreHostType) {
          return new BESProvider();
        }
        else if (hostDescription.getType() instanceof Ec2HostType) {
            return new EC2Provider();
        }
        else if (hostDescription.getType() instanceof SSHHostType) {
            return new SSHProvider();
        }
        else {
            return new LocalProvider();
        }
View Full Code Here

public class DescriptorUtil {

    public static HostDescription createHostDescription(String hostName, String hostAddress,
                                                        String hostEndpoint, String gatekeeperEndpoint, String providerType) {
        HostDescription host = new HostDescription();
        host.getType().setHostName(hostName);
        host.getType().setHostAddress(hostAddress);
        if(providerType.equalsIgnoreCase(HostTypes.GLOBUS_HOST_TYPE)){
           host.getType().changeType(GlobusHostType.type);
             ((GlobusHostType) host.getType()).
                     setGridFTPEndPointArray(new String[]{hostEndpoint});
             ((GlobusHostType) host.getType()).
                     setGlobusGateKeeperEndPointArray(new String[]{gatekeeperEndpoint});
        }else if (providerType.equalsIgnoreCase(HostTypes.SSH_HOST_TYPE)){
             host.getType().changeType(SSHHostType.type);
        }else if (providerType.equalsIgnoreCase(HostTypes.UNICORE_HOST_TYPE)){
           host.getType().changeType(GlobusHostType.type);
             ((UnicoreHostType) host.getType()).
                     setGridFTPEndPointArray(new String[]{hostEndpoint});
             ((UnicoreHostType) host.getType()).
                     setUnicoreHostAddressArray(new String[]{gatekeeperEndpoint});
        }
        return host;
    }
View Full Code Here

        hostDescriptor.setHostType(hostType);
        return hostDescriptor;
    }

    public static HostDescription createHostDescription (HostDescriptor hostDescriptor){
        HostDescription hostDescription = new HostDescription(HostDescriptionType.type);
        hostDescription.getType().setHostAddress(hostDescriptor.getHostAddress());
        hostDescription.getType().setHostName(hostDescriptor.getHostname());

        if (hostDescriptor.getHostType() != null && !hostDescriptor.getHostType().isEmpty()) {
            if (hostDescriptor.getHostType().get(0).equals(HostTypes.GLOBUS_HOST_TYPE)) {
                hostDescription.getType().changeType(GlobusHostType.type);
                if (!hostDescriptor.getGateKeeperEndPoint().isEmpty() && hostDescriptor.getGateKeeperEndPoint() != null){
                    ((GlobusHostType) hostDescription.getType()).addGlobusGateKeeperEndPoint(hostDescriptor.getGateKeeperEndPoint().get(0));
                }
                if (!hostDescriptor.getGridFTPEndPoint().isEmpty() && hostDescriptor.getGridFTPEndPoint() != null){
                    ((GlobusHostType) hostDescription.getType()).addGridFTPEndPoint(hostDescriptor.getGridFTPEndPoint().get(0));
                }

            } else if (hostDescriptor.getHostType().get(0).equals(HostTypes.GSISSH_HOST_TYPE)) {
                hostDescription.getType().changeType(GsisshHostType.type);
                if (!hostDescriptor.getGridFTPEndPoint().isEmpty() && hostDescriptor.getGridFTPEndPoint() != null){
                    ((GsisshHostType) hostDescription).addGridFTPEndPoint(hostDescriptor.getGridFTPEndPoint().get(0));
                }

            } else if (hostDescriptor.getHostType().get(0).equals(HostTypes.EC2_HOST_TYPE)) {
                hostDescription.getType().changeType(Ec2HostType.type);
                if (!hostDescriptor.getImageID().isEmpty() && hostDescriptor.getImageID() != null ){
                    ((Ec2HostType) hostDescription).addImageID(hostDescriptor.getImageID().get(0));
                }
                if (!hostDescriptor.getInstanceID().isEmpty() && hostDescriptor.getInstanceID() != null){
                    ((Ec2HostType) hostDescription).addInstanceID(hostDescriptor.getInstanceID().get(0));
                }

            }else if (hostDescriptor.getHostType().get(0).equals(HostTypes.SSH_HOST_TYPE)) {
              hostDescription.getType().changeType(SSHHostType.type);
            } else if (hostDescriptor.getHostType().get(0).equals(HostTypes.UNICORE_HOST_TYPE)) {
                 hostDescription.getType().changeType(UnicoreHostType.type);
                 if (!hostDescriptor.getGateKeeperEndPoint().isEmpty() && hostDescriptor.getGateKeeperEndPoint() != null){
                     ((UnicoreHostType) hostDescription.getType()).addUnicoreHostAddress(hostDescriptor.getGateKeeperEndPoint().get(0));
                 }
                 if (!hostDescriptor.getGridFTPEndPoint().isEmpty() && hostDescriptor.getGridFTPEndPoint() != null){
                     ((UnicoreHostType) hostDescription.getType()).addGridFTPEndPoint(hostDescriptor.getGridFTPEndPoint().get(0));
                 }
            }
        }

        return hostDescription;
View Full Code Here

        StAXOMBuilder builder = new StAXOMBuilder(reader);
        OMElement documentElement = builder.getDocumentElement();
        Iterator server = documentElement.getChildrenWithName(new QName("server"));
        while (server.hasNext()) {
            OMElement next = (OMElement) server.next();
            HostDescription hostDescription;
            if (next.getFirstChildWithName(new QName("gram.endpoint")) != null) {
                hostDescription = new HostDescription(GlobusHostType.type);
                ((GlobusHostType) hostDescription.getType()).addGlobusGateKeeperEndPoint(next.getFirstChildWithName(new QName("gram.endpoint")).getText());
                ((GlobusHostType) hostDescription.getType()).addGridFTPEndPoint(next.getFirstChildWithName(new QName("gridftp.endpoint")).getText());
            } else {
                hostDescription = new HostDescription(HostDescriptionType.type);
            }
            (hostDescription.getType()).setHostName(next.getFirstChildWithName(new QName("name")).getText());
            (hostDescription.getType()).setHostAddress(next.getFirstChildWithName(new QName("host")).getText());
            hostDescriptions.add(hostDescription);
        }
        return hostDescriptions;
    }
View Full Code Here

    return appDesc;
  }

  protected HostDescription getHostDesc() {
    HostDescription host = new HostDescription(UnicoreHostType.type);
    host.getType().setHostAddress(hostAddress);
    host.getType().setHostName(hostName);
    ((UnicoreHostType) host.getType()).setUnicoreHostAddressArray(hostArray);
    ((UnicoreHostType) host.getType()).setGridFTPEndPointArray(new String[]{gridftpAddress});
    return host;
  }
View Full Code Here

      String hostName = this.hostIdTextField.getText();
      if (hostName == null
          || hostName.trim().equals("")) {
        throw new Exception("Id of the host cannot be empty!!!");
      }
      HostDescription hostDescription2 = null;
        hostDescription2 = getRegistry().getApplicationManager().getHostDescription(hostName);
      if (hostDescription2 != null) {
        throw new Exception(
            "Host descriptor with the given id already exists!!!");
      }
View Full Code Here

        this.hostCreated = hostCreated;
    }

    public HostDescription getHostDescription() {
        if (hostDescription == null) {
            hostDescription = new HostDescription(GlobusHostType.type);
        }
        return hostDescription;
    }
View Full Code Here

        }
        return hostDescription;
    }

    public void saveHostDescription() {
        HostDescription desc = getHostDescription();
        try {
          if (getRegistry().getApplicationManager().isHostDescriptorExists(desc.getType().getHostName())){
            getRegistry().getApplicationManager().updateHostDescriptor(desc);
          }else{
            getRegistry().getApplicationManager().addHostDescription(desc);
          }
      setHostCreated(true);
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.