问题
In h2o's documentation for the Steam Prediction Service Builder, here, it says that the service builder can compile both h2o pojos (.java files) and mojos (downloaded from h2o flow in my case as a .zip (version 3.10.5.2), which I have been using in the manner shown here). However, doing something like this:
gives this error:
Problem accessing /makewar. Reason:
Compilation of pojo failed exit value 1 warning: [options] bootstrap class path not set in conjunction with -source 1.6
error: Class names, 'drf_denials_v4.zip', are only accepted if annotation processing is explicitly requested
1 error
1 warning
So how can I use mojo files in the servicec builder? DO I need to use the "exported" model file from h2o flow rather than the "downloaded" zip file? The reason that I need to use mojos rather than the .java pojos is that my model is too large to fit in the pojo downloadable from h2o flow.
UPDATE:
Trying to use the CLI with the command:
$ curl -X POST --form mojo=@drf_denials_v4.zip --form jar=@h2o-genmodel.jar localhost:55000/makewar > drf_denials_v4.war
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 106M 100 53.6M 100 52.7M 6748k 6632k 0:00:08 0:00:08 --:--:-- 229k
in the dir. containing the relevant files, then using the command:
prediction-service-builder git:(master)$ java -jar jetty-runner-9.3.9.M1.jar --port 55001 ~/Documents/h2o_production/mojos/drf_denials_v4/drf_denials_v4.war
gives the output:
2017-09-21 12:33:58.226:INFO::main: Logging initialized @232ms
2017-09-21 12:33:58.234:INFO:oejr.Runner:main: Runner
2017-09-21 12:33:58.558:INFO:oejs.Server:main: jetty-9.3.9.M1
2017-09-21 12:33:59.557:WARN:oeja.AnnotationConfiguration:main: ServletContainerInitializers: detected. Class hierarchy: empty
2017-09-21 12:34:00.068 -1000 [main] INFO ServletUtil - modelNames size 1
2017-09-21 12:34:01.285 -1000 [main] INFO ServletUtil - added model drf_denials_v4 new size 1
2017-09-21 12:34:01.290 -1000 [main] INFO ServletUtil - added 1 models
2017-09-21 12:34:01.291:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@4c75cab9{/,file:///tmp/jetty-0.0.0.0-55001-drf_denials_v4.war-_-any-39945022624149883.dir/webapp/,AVAILABLE}{file:///home/reedv/Documents/h2o_production/mojos/drf_denials_v4/drf_denials_v4.war}
2017-09-21 12:34:01.321:INFO:oejs.AbstractConnector:main: Started ServerConnector@176c9571{HTTP/1.1,[http/1.1]}{0.0.0.0:55001}
2017-09-21 12:34:01.322:INFO:oejs.Server:main: Started @3329ms
Going to localhost:55001, and trying to make a prediction, I see:
Notice that a prediction is given with a label, but there are no parameter input fields present and I get the cli error message:
2017-09-21 12:35:11.270:WARN:oejs.ServletHandler:qtp1531448569-12: Error for /info
java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:3332)
at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:124)
at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:448)
at java.lang.StringBuffer.append(StringBuffer.java:270)
at java.io.StringWriter.write(StringWriter.java:101)
at java.io.StringWriter.append(StringWriter.java:143)
at java.io.StringWriter.append(StringWriter.java:41)
at com.google.gson.stream.JsonWriter.value(JsonWriter.java:519)
at com.google.gson.internal.bind.TypeAdapters$5.write(TypeAdapters.java:210)
at com.google.gson.internal.bind.TypeAdapters$5.write(TypeAdapters.java:194)
at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68)
at com.google.gson.internal.bind.ArrayTypeAdapter.write(ArrayTypeAdapter.java:93)
at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68)
at com.google.gson.internal.bind.ArrayTypeAdapter.write(ArrayTypeAdapter.java:93)
at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:112)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:239)
at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:112)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:239)
at com.google.gson.Gson.toJson(Gson.java:661)
at com.google.gson.Gson.toJson(Gson.java:640)
at com.google.gson.Gson.toJson(Gson.java:595)
at com.google.gson.Gson.toJson(Gson.java:575)
at InfoServlet.doGet(InfoServlet.java:59)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:837)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:583)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
The cli pojo example works, but trying to use my mojo zip does not.
回答1:
Unfortunately, the UI has not been updated for mojo functionality yet. You can however use the command line to build war files with mojos.
Run this from your command line:
curl -X POST --form mojo=drf_denials_v4.zip --form jar=h2o-genmodel.jar localhost:55000/makewar > example.war
Then run the war file in the normal way.
For more information see: https://github.com/h2oai/steam/tree/master/prediction-service-builder
来源:https://stackoverflow.com/questions/46353578/using-mojos-in-h2o-steam-prediction-service-builder