web interface to DABC
Download
Report
Transcript web interface to DABC
THttpServer for ROOT
Bertrand Bellenot, CERN
Sergey Linev, GSI Darmstadt
28.02.2014
JSRootIO
Written on JavaScript, works in all major browsers
Allows to draw many kinds of ROOT objects
http://web-docs.gsi.de/~linev/JSRootIO/index_local.htm
Interactive graphics directly in the browser:
TH1, TH2, TH3, TProfile, TGraph, THStack, TCanvas
Demonstrator:
IE, Firefox, Opera, Safari, Android, …
changing of draw style, zooming, bins info
update of statistic in stat box
different context menu commands
Main aim – display objects from ROOT files
28.02.2014
PRO - no need for special code on the web server
CONTRA – not possible to update data dynamically
B.Bellenot, S.Linev, THttpServer for ROOT
2
JSRootIO for online?
JSRootIO is file-based
Much more benefits if will run online
difficult to use for online tasks
not really scales for big systems
one would see live results from running
experiment from any place of the world
One need special web application, which
can provide online data to JSRootIO
28.02.2014
B.Bellenot, S.Linev, THttpServer for ROOT
3
Web server for ROOT
THttpServer class provides web server for
arbitrary ROOT application
In any place of ROOT macro:
root [0] .x $ROOTSYS/tutorials/hsimple.C
root [1] new THttpServer();
No any changes in ROOT framework are required
No any changes in user code are required
28.02.2014
B.Bellenot, S.Linev, THttpServer for ROOT
4
hsimple.C in web browser
28.02.2014
B.Bellenot, S.Linev, THttpServer for ROOT
5
Main classes
TRootSniffer - `sniffer`for objects hierarchies in TFolder,
TFile/TDirectory, TTree, TCollection
THttpEngine – abstract class for implementing http protocol
TMongoose – embeddable web server, based on
TFastCgi – FastCGI protocol implementation
https://github.com/valenok/mongoose
supported by all major web servers like Apache, MS IIS, lighttpd, ...
THttpServer – central class
28.02.2014
receive http requests from engine(s)
http requests processed by sniffer
takes care about threads safety
B.Bellenot, S.Linev, THttpServer for ROOT
6
THttpServer
Any object can be registered in TFolder structure:
root [5] h1 = new TH1I(“h1”, “title”, 5, 0, 5);
root [6] serv->Register(“folder”, h1);
Following http requests are processed:
http://host:654/ROOT/h.xml
http://host:654/ROOT/h1/get.bin
png image, produced from TCanvas
http://host:654/ROOT/
28.02.2014
binary zipped data of current streamer infos
http://host:654/ROOT/h1/get.png?w=100&h=100
binary zipped data, produced by object streaming
http://host:654/ROOT/StreamerInfo/get.bin
xml file with objects hierarchy, used to build tree structures in browser
returns generic (or user-defined) html page, shown before
B.Bellenot, S.Linev, THttpServer for ROOT
7
FastCGI support
Protocol for interfacing interactive programs with web servers
Supported by all major web servers
One benefits from common infrastructure
Apache, lighttpd, MS IIS, Cherokee, Hiawatha, LiteSpeed, Kerio,
Nginx, Resin, Roxen, Zeus ...
user access, security, encryption, balancing, ...
Can run in parallel to HTTP server
ROOT
http
FastCGI
Apache
http
28.02.2014
B.Bellenot, S.Linev, THttpServer for ROOT
8
Project state
Developed since mid 2013
Works with ROOT 5.14 and 6.00
Tested on Linux and Windows
No external dependencies
mongoose is just two source files
mongoose is GPL2, can be replaced by civetweb with
MIT license
FastCGI is optional, provided by all Linux distributions
For the moment available on:
https://subversion.gsi.de/dabc/http/
28.02.2014
B.Bellenot, S.Linev, THttpServer for ROOT
9
Current applications
Integrated into DABC
DABC is DAQ framework, used in different experiments
now also provides generic web interface for online software
Integrated with Go4
Go4 is analysis framework with QtRoot online monitoring
interface
now also web interface without changing user-code
Evaluated by different groups in GSI:
DAQ – DABC, MBS (GSI standard DAQ)
slow control – FESA (CERN/GSI accelerator control), EPICS, DIM
online analysis – Go4, ROOT
HADES, SuperFRS, R3B
Could be used in AMORE framework of ALICE
28.02.2014
B.Bellenot, S.Linev, THttpServer for ROOT
10
Possible developments
Replace mongoose by ROOT TThread/TSocket classes
Implement caching on the server
many parts of original mongoose code can be reused, ~1 month of work
preventing application from overload, ~1 week of work
Implement more http requests
http://host:654/ROOT/h1/get.xml
http://host:654/ROOT/h1/get.json
access to object members in simple text form
mostly implemented, ~3 days of work
http://host:654/ROOT/Cmd/Reset/exe.cmd?par1=10
28.02.2014
stream object into JSON representation directly
no need for ROOT I/O in JavaScript
one need TBufferJSON class, ~2 weeks of work
http://host:654/ROOT/h1/fTitle/get.txt
convert object into xml with TBufferXML, ~1 hour of work
provide command interface via http protocol
any user-defined commands with extra parameters
user authentication with standard http methods
B.Bellenot, S.Linev, THttpServer for ROOT
11
More than web interface
One can use http protocol to communicate with any running
ROOT application
From any script:
wget http://host:654/ROOT/obj/fPar/get.txt
wget http://host:654/ROOT/obj/fPar/set.txt?value=1
For many cases no need for extra sockets and special
protocols
28.02.2014
B.Bellenot, S.Linev, THttpServer for ROOT
12
Backup slides
28.02.2014
B.Bellenot, S.Linev, THttpServer for ROOT
13
Use case – HADES
TRB
TRB
DABC
Event builder
EvBld
stream
HYDRA2
TRB
hld files
TRB
Event builder
hld
Event builder
hld
TRB
TRB
go4 gui
TRB
TRB
Event builder
hld
TRB
TRB
28.02.2014
web browser
B.Bellenot, S.Linev, THttpServer for ROOT
14
Use case – HADES
DABC as DAQ system
Stream event source to connect DAQ
HYDRA2 analysis gets data directly via socket
instead of temporary hld files
THttpServer for analysis monitoring
collects data from TRBs
store HLD files
deliver data to online analysis
no any change in HYDRA2 itself
Monitor DAQ and analysis via same
interface
28.02.2014
B.Bellenot, S.Linev, THttpServer for ROOT
15
Use case – HADES
DABC
Event builder
EvBld
stream
hld files
HYDRA2
HYDRA2
HYDRA2
HYDRA2
HYDRA2
Histograms
collector
Online analysis
Many processes in parallel
doing same events or different events
Histograms collector
28.02.2014
(to be done)
B.Bellenot, S.Linev, THttpServer for ROOT
16
Go4ExampleSimple in web browser
28.02.2014
B.Bellenot, S.Linev, THttpServer for ROOT
17
Use case – DAQ and slow-control middleware
ROOT online
analysis
FESA
go4 online
analysis
beam
profiles
DABC
DAQ
http
status and log
information
MBS
28.02.2014
MBS
slow-control
variables
DABC
EPICS
B.Bellenot, S.Linev, THttpServer for ROOT
18
Use case – several DABC nodes
MBS
MBS
DABC
socket
http
FastCGI
FESA
go4 online
analysis
EPICS
DABC
socket
http
Preferable
FastCGI
Apache
MBS
ROOT
analysis
DABC
Master
http
DABC
socket
http
FastCGI
http
Optional
ROOT
analysis
28.02.2014
B.Bellenot, S.Linev, THttpServer for ROOT
19
Alternatives to web browser
web browser
DABC
http
SOAP, JSON
DABC API
socket
console-based tools
28.02.2014
go4 gui with
native ROOT graphics
B.Bellenot, S.Linev, THttpServer for ROOT
20
How it works – hierarchy request
wget http://lxg0538:8090/FESA/h.xml
<?xml version="1.0"?>
<dabc version="2" xmlns:dabc="http://dabc.gsi.de/xhtml" path="/FESA/">
<FESA>
<Monitor dabc:producer="dabc://lxg0538:1237/fesa_monitor">
<GetMeasVoltage dabc:history="100"/>
<GetMeasCurrent dabc:history="100"/>
<GetMeasWeight dabc:history="100"/>
</Monitor>
<Test dabc:producer="dabc://lxg0538:1237/fesa">
<BeamProfile dabc:hash="74647" dabc:kind="FESA.2D"/>
<BeamRate dabc:kind="rate"/>
<BeamRate2 dabc:history="100" dabc:kind="rate"/>
<TestRate dabc:history="100" dabc:kind="rate"/>
<StreamerInfo dabc:hash="32" dabc:kind="ROOT.TList"/>
<BeamRoot dabc:hash="7464700" dabc:kind="ROOT.TH2I" dabc:master="StreamerInfo"/>
<ImageRoot dabc:kind="image.png"/>
</Test>
</FESA>
</dabc>
28.02.2014
B.Bellenot, S.Linev, THttpServer for ROOT
21
How it works – item request
wget http://lxg0538:8090/FESA/Test/TestRate/get.xml
server
item
request
<Reply xmlns:dabc="http://dabc.gsi.de/xhtml" itemname="/FESA/Test/TestRate" dabc:version="75177">
<get dabc:history="100" dabc:kind="rate" time="2013-09-20T12:12:43.874Z" value="96.00"/>
</Reply>
28.02.2014
B.Bellenot, S.Linev, THttpServer for ROOT
22
How it works – history request
wget http://lxg0538:8090/FESA/Test/TestRate/get.xml?history=20
<Reply xmlns:dabc="http://dabc.gsi.de/xhtml" itemname="/FESA/Test/TestRate" dabc:version="75713">
<get dabc:history="100" dabc:kind="rate" time="2013-09-20T12:21:39.935Z" value="32.00">
<history gap="true">
<h time="2013-09-20T12:21:19.933Z" value="112.00"/>
<h time="2013-09-20T12:21:20.933Z" value="112.01"/>
<h time="2013-09-20T12:21:21.933Z" value="112.02"/>
<h time="2013-09-20T12:21:22.933Z" value="112.03"/>
<h time="2013-09-20T12:21:23.933Z" value="116.00"/>
<h time="2013-09-20T12:21:24.933Z" value="116.01"/>
<h time="2013-09-20T12:21:25.933Z" value="116.02"/>
<h time="2013-09-20T12:21:26.933Z" value="116.03"/>
<h time="2013-09-20T12:21:27.934Z" value="20.00"/>
<h time="2013-09-20T12:21:28.934Z" value="20.01"/>
<h time="2013-09-20T12:21:29.934Z" value="20.02"/>
<h time="2013-09-20T12:21:30.934Z" value="20.03"/>
<h time="2013-09-20T12:21:31.934Z" value="24.00"/>
<h time="2013-09-20T12:21:32.934Z" value="24.01"/>
<h time="2013-09-20T12:21:33.934Z" value="24.02"/>
<h time="2013-09-20T12:21:34.934Z" value="24.03"/>
<h time="2013-09-20T12:21:35.935Z" value="28.00"/>
<h time="2013-09-20T12:21:36.935Z" value="28.01"/>
<h time="2013-09-20T12:21:37.935Z" value="28.02"/>
<h time="2013-09-20T12:21:38.935Z" value="28.03"/>
</history>
</get>
</Reply>
28.02.2014
B.Bellenot, S.Linev, THttpServer for ROOT
23