I am building a shiny app that scores the data of the deep learning model using h2o
engine.
I could achieve my goal by simply placing my predicting operation into the function. In this function I would typically start my deep learning machine, make calculations and stop it. This is unfortunately slow.
My goal is to start h2o
in the beginning, when user starts shiny app
from R-Server
and then to make sure the h2o
virtual machine will shutdown when user closes the browser.
I would ask to suggest the most optimal way to do that because I am not fully satisfied with this method taken from here where I just placed these lines of code into global.R
script:
#global.R
library(h2o)
h2o.init(nthreads = 2)
onStop(function() {
# shut down the h2o on app exit see
h2o.shutdown(prompt = FALSE)
})
It seems that sometimes my h2o instance is stopped before as I got an error Error in h2o.shutdown(prompt = FALSE) : There is no H2O instance running.
... I am now testing it in the browser but I just want to make sure there would be no consequences on the R-Server
Any help is appreciated!