Step 11 - Stopping the Spark session and H2O context

Finally, stop the Spark session and H2O context. The following stop() method invocation will shut down the H2O context and Spark cluster, respectively:

h2oContext.stop(stopSparkContext = true)spark.stop()

The first one, especially, is more important, otherwise it sometimes does not stop the H2O flow but still holds the computing resources.

Get Scala Machine Learning Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.