Canadianness tutorial: How do I actually run it?

59 views
Skip to first unread message

Andrew Shaw Care

unread,
Jan 20, 2018, 6:49:25 PM1/20/18
to Flow Based Programming
I forked the canadianness repo here: https://github.com/andrewshawcare/canadianness

I added docker and docker-compose (so you can `docker-compose up` and access the flowhub UI from http://localhost:9999 or by using the generated URL).

My question is... how do I run this project and see the scores? I looked at the tests and added something similar to:

'./spellingdata.json' -> read(filesystem/ReadFile) -> words(strings/ParseJson)
words -> SPELLING graph(canadianness/Canadianness)

to get the spelling data, but the words is listed as a LIST but shows up in the canadianness.yaml as an object? Not sure how to setup this graph to print out the results, brand new to NoFlo. Any help would be appreciated!

Henri Bergius

unread,
Jan 22, 2018, 10:39:17 AM1/22/18
to flow-based-...@googlegroups.com
Hi!

On Sun 21. Jan 2018 at 00:49, Andrew Shaw Care <andrews...@gmail.com> wrote:
I forked the canadianness repo here: https://github.com/andrewshawcare/canadianness

I added docker and docker-compose (so you can `docker-compose up` and access the flowhub UI from http://localhost:9999 or by using the generated URL).

Ah, that's a nice idea. Would you like to make a pull request with the Docker setup?

My question is... how do I run this project and see the scores? I looked at the tests and added something similar to:

'./spellingdata.json' -> read(filesystem/ReadFile) -> words(strings/ParseJson)
words -> SPELLING graph(canadianness/Canadianness)

to get the spelling data, but the words is listed as a LIST but shows up in the canadianness.yaml as an object? Not sure how to setup this graph to print out the results, brand new to NoFlo. Any help would be appreciated!

The core/Output component can be used for writing to STDOUT.

/Henri

Andrew Shaw Care

unread,
Jan 22, 2018, 11:26:23 AM1/22/18
to Flow Based Programming
I'm going to try and understand the example better as I have been unable to get it to run in Flowhub (I am noticing that running --batch from the command line seems to provide more output, not sure why, could be how I'm using Docker?), but a few points of confusion so far (that I haven't been able to find documentation on):
  • What are brackets? How do I interact with opening and closing brackets?
  • What are streams? How are they different from packets? How do I interact with them? How do I handle brackets in streams?
  • How can I console.log in a component?
My apologies if that's already laid out in the tutorial, but it would be ideal if it ended with the graph running in batch mode or in Flowhub to get a sense of how you actually execute your graph after you create it (i.e. how to create a parent graph that creates inputs and outputs to initialize the graph).

Thanks!

Andrew Shaw Care

unread,
Jan 22, 2018, 3:23:22 PM1/22/18
to Flow Based Programming
Nevermind. I have no idea why but I wasn't getting output. I removed some command line arguments and things are working! Sorry for the confusion.

Andrew Shaw Care

unread,
Jan 22, 2018, 3:27:08 PM1/22/18
to Flow Based Programming
Ah, it seems like if I have syntax errors noflo-nodejs just fails silently? I had

const in = input.getData('in');

and in is a keyword. Is there a way to see stderr if there's a problem loading the graph/components?

Henri Bergius

unread,
Jan 23, 2018, 6:16:01 AM1/23/18
to flow-based-...@googlegroups.com
Hi,

On Mon, 22 Jan 2018 at 21:27 Andrew Shaw Care <andrews...@gmail.com> wrote:
Ah, it seems like if I have syntax errors noflo-nodejs just fails silently? I had

const in = input.getData('in');

and in is a keyword. Is there a way to see stderr if there's a problem loading the graph/components?

This depends on how you start the noflo-nodejs runtime. If you use the catch-exceptions option, these will not be shown on the runtime side, but instead transmitted to the FBP protocol client.

If you disable that option, you should see the stack traces directly in the console where you're executing the runtime.

/Henri

Andrew Shaw Care

unread,
Jan 23, 2018, 3:50:47 PM1/23/18
to Flow Based Programming
Ah, that is helpful, thanks! It might be useful to keep that in standard output, however. It was really confusing to see a notification instead of stderr. :)

Also, I created a tutorial that might be helpful for new FBPers: https://github.com/andrewshawcare/noflojs-telegram-problem

It's a solution to, "The Telegram Problem" and it has a "demo" graph that scaffolds out a ReadFile and an Output component to give an example of how to compose and debug graphs.
Reply all
Reply to author
Forward
0 new messages