Launching H2O Clusters on Different Ports in pysparkling [Code Snippets]

DZone 's Guide to

Launching H2O Clusters on Different Ports in pysparkling [Code Snippets]

Learn how to launch an H2O machine learning cluster using the pysparkling package with the approrpiate Python code script.

· AI Zone ·
Free Resource

In this example, we will launch an H2O machine learning cluster using the pysparkling package. You can visit my GitHub and this article to learn more about the code execution explained here.

First, install pysparkling in Python 2.7, set up as below:

> pip install -U h2o_pysparkling_2.1

Now we can launch the pysparkling Shell as below:


Launch pysparkling shell:

~/tools/sw2/sparkling-water-2.1.14 $ bin/pysparkling

Here's the Python code script to launch the H2O cluster in pysparkling:

## Importing Libraries
from pysparkling import *
import h2o

## Setting H2O Conf Object
h2oConf = H2OConf(sc)

## Setting H2O Conf for different port

## Gett H2O Conf Object to see the configuration

## Launching H2O Cluster
hc = H2OContext.getOrCreate(spark, h2oConf)

## Getting H2O Cluster status

Now, if you verify the sparkling water configuration, you will see that H2O is running on the given IP and port 54300 as configured:

Sparkling Water configuration:
  backend cluster mode : internal
  workers              : None
  cloudName            : Not set yet, it will be set automatically before starting H2OContext.
  flatfile             : true
  clientBasePort       : 54300
  nodeBasePort         : 54300
  cloudTimeout         : 60000
  h2oNodeLog           : INFO
  h2oClientLog         : WARN
  nthreads             : -1
  drddMulFactor        : 10

That's it; enjoy!

ai, h2o, machine learning, pysparkling, python, tutorial

Published at DZone with permission of Avkash Chauhan , DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}