water
Class AbstractEmbeddedH2OConfig

java.lang.Object
  extended by water.AbstractEmbeddedH2OConfig

public abstract class AbstractEmbeddedH2OConfig
extends java.lang.Object

This class is a small shim between a main java program (such as a Hadoop mapper) and an embedded full-capability H2O.


Constructor Summary
AbstractEmbeddedH2OConfig()
           
 
Method Summary
abstract  void exit(int status)
          Tell the embedding software that H2O wants the process to exit.
abstract  java.lang.String fetchFlatfile()
          If configProvidesFlatfile, get it.
abstract  void notifyAboutCloudSize(java.net.InetAddress ip, int port, int size)
          Tell the embedding software that this H2O instance belongs to a cloud of a certain size.
abstract  void notifyAboutEmbeddedWebServerIpPort(java.net.InetAddress ip, int port)
          Tell the embedding software that H2O has started an embedded web server on an IP and port.
abstract  void print()
          Print debug information.
abstract  boolean providesFlatfile()
          Whether H2O gets a flatfile config from this config object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractEmbeddedH2OConfig

public AbstractEmbeddedH2OConfig()
Method Detail

notifyAboutEmbeddedWebServerIpPort

public abstract void notifyAboutEmbeddedWebServerIpPort(java.net.InetAddress ip,
                                                        int port)
Tell the embedding software that H2O has started an embedded web server on an IP and port. This may be nonblocking.

Parameters:
ip - IP address this H2O can be reached at.
port - Port this H2O can be reached at (for REST API and browser).

providesFlatfile

public abstract boolean providesFlatfile()
Whether H2O gets a flatfile config from this config object.

Returns:
true if H2O should query the config object for a flatfile. false otherwise.

fetchFlatfile

public abstract java.lang.String fetchFlatfile()
                                        throws java.lang.Exception
If configProvidesFlatfile, get it. This may incur a blocking network call. This must be called after notifyAboutEmbeddedWebServerIpPort() or the behavior will be undefined. This method includes it's own address, because the config may be building up and managing a directory of H2O nodes. If this method throws any kind of exception, the node failed to get it's config, and this H2O is hosed and should exit gracefully.

Returns:
A string with the multi-line flatfile text.
Throws:
java.lang.Exception

notifyAboutCloudSize

public abstract void notifyAboutCloudSize(java.net.InetAddress ip,
                                          int port,
                                          int size)
Tell the embedding software that this H2O instance belongs to a cloud of a certain size. This may be nonblocking.

Parameters:
ip - IP address this H2O can be reached at.
port - Port this H2O can be reached at (for REST API and browser).
size - Number of H2O instances in the cloud.

exit

public abstract void exit(int status)
Tell the embedding software that H2O wants the process to exit. This should not return. The embedding software should do any required cleanup and then call exit with the status.

Parameters:
status - Process-level exit status

print

public abstract void print()
Print debug information.