0

Running supervisor headlessly

Gregory Rehm 9 years ago updated by Luke Fletcher 9 years ago 10

Hi,


I was wondering if the openice supervisor could be run headlessly (without GUI). I've been poking around at it on my own computer and I got as far as


./bin/OpenICE -app ICE_Supervisor -domain 15


To which java gives me an error.


Exception in thread "main" java.lang.IllegalStateException: Failed to create command instance org.mdpnp.apps.testapp.IceAppsContainer

at org.mdpnp.apps.testapp.Configuration.getCommand(Configuration.java:126)
at org.mdpnp.apps.testapp.Main.main(Main.java:59)


It seems java wants some kind of command before we can proceed but there doesn't seem to be any available documentation on commands to use. Was wondering


1. Even if I take this to its terminus can we run the process headlessly?

2. What are the lists of available commands to use?

I've been working to figure out the same exact thing and haven't had much luck at all. Based on the existing code, I don't think it is possible. We are now trying to modify the code to allow for this case, but it has been difficult to separate the GUI aspects from the non-GUI aspects.

Well I applaud you for trying. Our team might also need to make similar modifications in the future. Perhaps we can share notes sometime? Are you tracking your changes on github right now or are you keeping everything local?

Since what we mostly wanted was direct access to the DDS messages coming from the devices, we have gone the route of using the Hello OpenICE example to receive those and proceeding from there. You can run that example straight on the command line.

Hi Peter and Gregory. One of the main issues about running OpenICE in headless mode is that there is, as far as I know, no capacity to connect to monitors over LAN or serial without the GUI. Of course, once connected you also need a means of obtaining the data from OpenICE. To this end, I modified the OpenICE source and Hello OpenICE to build an app that responds to SocketIO calls to connect to a monitor, and then once connected, transmits data back via SocketIO. It is then possible to build an app, in your programming language of choice, that can display/save this data in whatever means you deem fit. It's an elegant solution, and once you eliminate all of the JavaFX components, it runs just fine on a BeagleBone Black. Let me know if this is something that might be of help. Cheers!

Hey Luke this would be a major help to our team! Do you have any qualms with sharing the source code?

I haven't really done anything special compared with what the OpenICE/MD PnP team has achieved. And most of the code is taken directly out of the OpenICE anyway, so I hardly claim ownership of it. The code is all yours :) https://github.com/lukefletcher/CirculateICE

Thanks Luke! I've never used SocketIO before but it seems like you're using it like a channel for communication between java programs. Is that correct?

That's right. SocketIO is a node.js module. It's used primarily by servers to push information to clients (like web browsers, iOS/Android platforms, etc) in real time. It's (likely) used to power the OpenICE demo on the website. SocketIO has a lot of clients available in a variety of languages. If you don't want to use SocketIO and want to build your entire app platform in Java, you can ditch the "SocketController" class and call the relevant methods in "DSSController" directly. However, in my case, I wanted to use node.js (written in Javascript) as my web server and have it talk to OpenICE, which is obviously written in Java. To facilitate communication between the two, I used SocketIO. Hope that helps

OK thanks, that explanation helps a lot with Socket IO. jw, were you able to work at all on storing the data headlessly as well?

Yeah my node.js app saves incoming data from OpenICE to a MongoDB database. But you could wire it up to an SQL database, or whatever data storage option works for you.