Avoid lock when child dies
[src/app-framework-binder.git] / memo-supervisor.txt
1
2 Run the supervisor on the target for the public IP:
3 ---------------------------------------------------
4
5         # afs-supervisor --port 1619 --token HELLO
6
7 Run the client
8 --------------
9
10         # afb-client-demo -H host:1619/api?token=HELLO
11
12
13 verbs that can be run, all are of the API 'supervisor':
14 -------------------------------------------------------
15
16         - discover
17
18                 send SIGHUP to daemons not recorded to make them connected
19
20         - list
21
22                 list the connected daemons
23
24         - config        {"pid":X}
25
26                 get the configuration of the daemon of pid X
27
28         - sessions      {"pid":X}
29
30                 get the active sessions and token of the daemon of pid X
31
32         - session-close {"pid":X, "uuid":UUID}
33
34                 closes the sessions of uuid UUID for the daemon of pid X
35
36         - exit          {"pid":X,"code":Y}
37
38                 exit the daemon of pid X with optional code Y (default 0)
39
40         - debug-wait    {"pid":X}
41
42                 make the daemon of pid X wait for a signal SIGINT
43
44         - debug-break   {"pid":X}
45
46                 make the daemon of pid X self killing with SIGINT
47
48         - do            {"pid":X,"api":A,"verb":V,"args":A}
49
50                 execute the API/VERB(ARGS) for the daemon of pid X
51
52                 useful for (s/g)etting monitor info. ex: monitor/get({"apis":true})
53
54                 bound to the current client session (to be checked: usurpation of session?)
55
56         - trace         {"pid":X, ...}
57
58                 like monitor/trace but not bound to session (in the future monitor/trace
59                 will be bound to sessions)
60
61                 allows to trace specific session or any session
62
63                 the pid isn't returned in the event (not sure to want it but open...)
64
65                 use "name" and "tag" feature of "trace" to discriminate events on the client side.
66
67 Examples of dialog:
68 -------------------
69
70 supervisor discover
71 ON-REPLY 1:supervisor/discover: OK
72 {
73   "jtype":"afb-reply",
74   "request":{
75     "status":"success",
76     "uuid":"22563ce6-e07f-4284-91f8-e7eb7ec4ef21"
77   }
78 }
79
80
81 supervisor list
82 ON-REPLY 2:supervisor/list: OK
83 {
84   "response":{
85     "7054":{
86       "pid":7054,
87       "uid":1001,
88       "gid":1001,
89       "id":"NoLabel",
90       "label":"NoLabel",
91       "user":"1001"
92     }
93   },
94   "jtype":"afb-reply",
95   "request":{
96     "status":"success"
97   }
98 }
99
100
101
102 supervisor config {"pid":7054}
103 ON-REPLY 3:supervisor/config: OK
104 {
105   "response":{
106     "console":".\/AFB-console.out",
107     "rootdir":".",
108     "roothttp":"..\/test",
109     "rootbase":"\/opa",
110     "rootapi":"\/api",
111     "workdir":".",
112     "uploaddir":".",
113     "token":"",
114     "name":null,
115     "aliases":[
116       "\/monitoring"
117     ],
118     "dbus_clients":[
119     ],
120     "dbus_servers":[
121     ],
122     "ws_clients":[
123     ],
124     "ws_servers":[
125     ],
126     "so_bindings":[
127     ],
128     "ldpaths":[
129       "\/opt\/jobol\/lib64\/afb"
130     ],
131     "weak_ldpaths":[
132     ],
133     "calls":[
134     ],
135     "exec":[
136     ],
137     "httpdPort":5555,
138     "cacheTimeout":100000,
139     "apiTimeout":20,
140     "cntxTimeout":32000000,
141     "nbSessionMax":10,
142     "mode":"local",
143     "tracereq":"no",
144     "traceditf":"no",
145     "tracesvc":"no",
146     "traceevt":"no",
147     "traceses":"no",
148     "no_ldpaths":false,
149     "noHttpd":false,
150     "background":false,
151     "monitoring":true,
152     "random_token":false
153   },
154   "jtype":"afb-reply",
155   "request":{
156     "status":"success"
157   }
158 }
159
160
161
162
163
164 supervisor sessions {"pid":7054}
165 ON-REPLY 4:supervisor/sessions: OK
166 {
167   "response":{
168     "2273ff8d-ee46-4059-959b-0f90fa90f25e":{
169       "token":""
170     },
171     "22563ce6-e07f-4284-91f8-e7eb7ec4ef21":{
172       "token":""
173     }
174   },
175   "jtype":"afb-reply",
176   "request":{
177     "status":"success"
178   }
179 }
180
181
182
183
184
185 supervisor do {"pid":7054,"api":"monitor","verb":"get","args":{"apis":true}}
186 .....VERY LONG RESPONSE.....
187
188
189
190
191 supervisor trace { "pid": 7054, "add": { "request": "common" } }
192 ON-REPLY 6:supervisor/trace: OK
193 {
194   "jtype":"afb-reply",
195   "request":{
196     "status":"success"
197   }
198 }
199
200
201
202
203
204 ON-EVENT supervisor/trace:
205 {
206   "event":"supervisor\/trace",
207   "data":{
208     "time":"34353.598120",
209     "tag":"trace",
210     "type":"request",
211     "id":34,
212     "request":{
213       "index":1,
214       "api":"ave",
215       "verb":"ping",
216       "action":"begin",
217       "session":"be67cfb8-a346-47c1-ac63-65aaff3599bf"
218     }
219   },
220   "jtype":"afb-event"
221 }
222 ON-EVENT supervisor/trace:
223 {
224   "event":"supervisor\/trace",
225   "data":{
226     "time":"34353.598182",
227     "tag":"trace",
228     "type":"request",
229     "id":35,
230     "request":{
231       "index":1,
232       "api":"ave",
233       "verb":"ping",
234       "action":"json",
235       "session":"be67cfb8-a346-47c1-ac63-65aaff3599bf"
236     },
237     "data":{
238       "result":"true"
239     }
240   },
241   "jtype":"afb-event"
242 }
243 ON-EVENT supervisor/trace:
244 {
245   "event":"supervisor\/trace",
246   "data":{
247     "time":"34353.598214",
248     "tag":"trace",
249     "type":"request",
250     "id":36,
251     "request":{
252       "index":1,
253       "api":"ave",
254       "verb":"ping",
255       "action":"success",
256       "session":"be67cfb8-a346-47c1-ac63-65aaff3599bf"
257     },
258     "data":{
259       "result":"Some String",
260       "info":"Ping Binder Daemon tag=pingSample count=1 query=\"true\""
261     }
262   },
263   "jtype":"afb-event"
264 }
265 ON-EVENT supervisor/trace:
266 {
267   "event":"supervisor\/trace",
268   "data":{
269     "time":"34353.598292",
270     "tag":"trace",
271     "type":"request",
272     "id":37,
273     "request":{
274       "index":1,
275       "api":"ave",
276       "verb":"ping",
277       "action":"end",
278       "session":"be67cfb8-a346-47c1-ac63-65aaff3599bf"
279     }
280   },
281   "jtype":"afb-event"
282 }
283
284
285 Usefull commands:
286 -----------------
287
288   TARGET=...
289
290   afb-client-demo -H ws://$TARGET:1619/api?token=HELLO\&uuid=HELLO supervisor list
291
292   afb-client-demo -H ws://$TARGET:1619/api?token=HELLO\&uuid=HELLO config '{"pid":XXXX}'
293
294   
295