UNPKG

2.73 kBMarkdownView Raw
1
2noflo-runtime-msgflo
3====================
4
5[NoFlo](https://noflojs.org) runtime, designed for use with [msgflo](https://github.com/the-grid/msgflo).
6Loads a NoFlo graph and registers it as a msgflo participant.
7The exported ports of the NoFlo network then becomes accessible through message queues
8([AMQP](http://en.wikipedia.org/wiki/Advanced_Message_Queuing_Protocol) or [MQTT](http://en.wikipedia.org/wiki/MQTT)),
9and msgflo can coordinate how multiple such networks send data between eachother.
10
11Will eventually allow a single entry-point for
12[FBP runtime protocol](http://noflojs.org/documentation/protocol) clients (like [Flowhub](http://flowhub.io))
13to access NoFlo FBP networks that span multiple nodes.
14
15
16Usage
17------
18
19Using the commandline tool
20
21 noflo-runtime-msgflo --name myworker --graph project/WorkerGraph --broker amqp://foo.cloudamqp.com/bar
22
23Altenatively one can use the embedding API, see [src/mount.coffee](./src/mount.coffee)
24
25 runtime = require 'noflo-runtime-msgflo'
26 options =
27 name: 'gssmeasure'
28 graph: 'the-grid-api/PrecomputeGss',
29 basedir: __dirname
30 broker: config.amqp.url,
31 rt = new runtime.mount.Mounter options
32 rt.start (err, rt) ->
33 # started
34
35
36## Debugging
37
38noflo-runtime-msgflo supports [flowtrace](https://github.com/flowbased/flowtrace) allows to trace & store the execution of the NoFlo network,
39so you can debug any issues that would occur.
40You can enable tracing using `--trace` commandline argument,
41or via the `trace:start` [FBP runtime protocol](http://noflojs.org/documentation/protocol/#trace) message.
42
43 noflo-runtime-msgflo --graph project/MyMainGraph --trace
44
45To trigger dumping a flowtrace locally, send the `SIGUSR2` Unix signal
46
47 kill -SIGUSR2 $PID_OF_PROCESS
48 ... Wrote flowtrace to: /tmp/1151020-12063-ami5vq.json
49
50Or, to trigger a flowtrace remotely, send a `trace:dump` FBP protocol message to the queue of participant.
51
52 msgflo-send-message --queue .fbp.$participantId.receive --json '{ "protocol":"trace", "command":"dump", "payload":{ "graph":"default", "type":"flowtrace.json"} }'
53
54Then, assuming `.fbp.$participantId.send` has been bound to queue `my-flowtraces`, one could download it
55
56 msgflo-dump-message --queue my-flowtraces --amount 1
57
58You can now use various flowtrace tools to introspect the data.
59For instance, you can get a human readable log using `flowtrace-show`
60
61 flowtrace-show /tmp/1151020-12063-ami5vq.json
62
63 -> IN repeat CONN
64 -> IN repeat DATA hello world
65 -> IN stdout CONN
66 -> IN stdout DATA hello world
67 -> IN repeat DISC
68 -> IN stdout DISC
69
70
71TODO
72-----
73
74### 0.3
75
76* Implement [FBP protocol over msgflo](https://github.com/noflo/noflo-runtime-msgflo/issues/30) transport