Pre-loading H2O stuff after server restart RRS feed

  • Question

  • Hi all,

    I've deployed a predictive function as web service on a Machine Learning Server.

    My function uses a H2O model to do predictions, so I have to pre-load the model in memory in order to have the function working.

    After using the following code for publish the web service, all works like a charm:

    api <- publishService(     "My_string",    # Don't use spaces in this string     code = predict_from_model_WS,
        model = "MLServer_model.R",     inputs = list(input = "data.frame"),     outputs = list(answer = "vector"),    v = "0.0.1"  )

    All works because the MLServer_model.R script launches a H2O instance on the default port and then loads some variables (including the model one used in the predict_from_model_WS function) from files.

    Now, when the server restarts, it seems that all the operations done by the MLServer_model.R script are not executed. So I'm forced to "manually" execute a batch to run a H2O cluster and another one to load the R variables used by the predictive function.

    Is there a way to automatically launch a H2O cluster and pre-load all the needed variables when the Machine Learning Server nodes starts?

    Luca Zavarella, Mentor & Technical Director | Data Science MPP | Twitter: @lucazav

    Wednesday, June 26, 2019 9:10 AM

All replies

  • The way to do this is to add these options to the end of the file under 'C:\Program Files\Microsoft\ML Server\R_SERVER\etc' folder. Any settings in that file get loaded on the startup of ML Server.  You could also add a 'library(h2o))' command to that file to load the library on startup.

    If you are running in a multi-user environment you can create a user-specific .Rprofile file.  Here is more information on how to do that:

    Wednesday, June 26, 2019 10:04 PM