Run a model in server mode
Note: the issue was created automatically with bugzilla2github tool
Original bug ID: BZ#456 From: Elizabeth Latronico <[email protected]> Reported version: 8.1.devel
Blocker for: BZ#455
Create the ability to run a Ptolemy model as a web service on a web server. Leverage ptserver code from CMU students (who used MQTT protocol) where appropriate.
- Develop sandbox for running models (due to security concerns with expression language)
- Develop attribute that can be dragged into the model to indicate whether model is running on a server or not
- Develop RESTful interface for actors (parsed from web string) - see RESTful interface story
- Allow running models in background on web server which periodically update web pages
Information about Ptolemy II and sandboxes may be found at http://ptolemy.eecs.berkeley.edu/ptolemyII/ptIIlatest/ptII/doc/sandbox.htm
Graphical models to be run on a server need to have a graphical display. Locally, we use the X11 Virtual Frame Buffer on hudson.eecs to provide a virtual display. The commands to start Xvfb and set DISPLAY are:
Xvfb :5 -screen 0 1024x768x2 & export DISPLAY=localhost:5.0
The nightly build runs code that exports the seating chart of the DOP Center each night.
- Hudson runs each night on sisyphus
- Hudson has a configuration step that runs cd $PTII/adm/gen-9.0; make hudson
- The hudson rule in the makefile has a dependency on updateDOPCenterImage
- The updateDOPCenterImage rule runs $PTII/adm/gen-9.0/updateDOPCenterImageX11
- updateDOPCenterImageX11 is a script that starts up X11, invokes $PTII/ptolemy/domains/space/demo/DOPCenter/updateDOPCenterImage and stops X11. updateDOPCenterImageX11 would be a good place to add other scripts to run other models. We could have cronjob that runs updateDOPCenterImageX11 more often
- $PTII/ptolemy/domains/space/demo/DOPCenter/updateDOPCenterImage invokes ExportModel and compares the result against the previous result. If the result is different, then the change is committed.
Note that the ptII tree gets copied over to http://chess.eecs.berkeley.edu/ptexternal/src/ptII/ on a nightly basis.
Do do updates to the chess site more often would require having the script that runs the model use scp. For example, to update $PTII/doc/coding/addinganactor.htm, which appears as http://chess.eecs.berkeley.edu/ptexternal/src/ptII/doc/coding/addinganactor.htm the following command would be run as hudson on sisyphus:
scp -Bprq /var/lib/hudson/jobs/ptII/workspace/doc/coding/addinganactor.htm andrews:/home/www/cvswww/chess.eecs.berkeley.edu/ptexternal/nightly/doc/coding/addinganactor.htm
Typically, when running a model, the model is run inside the Swing Event Thread. Example code may be found at ptolemy/vergil/basic/export/ExportModel.java