Search code examples
noflo

noflo cannot shutdown execution


I'm trying to run some simple graph using noflo-filesystem and noflo-csv that reads CSV file, parses it and writes it down to file. The issue is that the program waits for something that I don't know how to provide:

graph.fbp

Read(filesystem/ReadFile) OUT -> CSV ParseCSV(csv/ConvertCsvToMatrix)
ParseCSV OUT -> IN Write(filesystem/WriteFile)    
'dump.csv' -> FILENAME Write(filesystem/WriteFile)
'data.csv' -> In Read

When I run

.\node_modules\.bin\noflo-nodejs --graph graphs\graph.fbp --batch --register=false --debug

I get:

DATA -> FILENAME Write() CONN
DATA -> FILENAME Write() DATA
DATA -> FILENAME Write() DISC
DATA -> IN Read() CONN
DATA -> IN Read() DATA
DATA -> IN Read() DISC
DATA -> ENCODING Read() CONN
DATA -> ENCODING Read() DATA
DATA -> ENCODING Read() DISC
Read() OUT -> CSV ParseCSV() CONN
Read() OUT -> CSV ParseCSV() < ..\python_code\web_app\TimeSeries.csv
Read() OUT -> CSV ParseCSV() DATA
Read() OUT -> CSV ParseCSV() > ..\python_code\web_app\TimeSeries.csv
Read() OUT -> CSV ParseCSV() DISC
ParseCSV() OUT -> IN Write() CONN
ParseCSV() OUT -> IN Write() DATA

And then the program is hanging.

I tried to feed Write's IN port with just a string like:

Read(filesystem/ReadFile) OUT -> CSV ParseCSV(csv/ConvertCsvToMatrix)
'some text' -> IN Write(filesystem/WriteFile)    
'dump.csv' -> FILENAME Write(filesystem/WriteFile)
'data.csv' -> In Read

And this works fine:

DATA -> IN Write() CONN
DATA -> IN Write() DATA
DATA -> IN Write() DISC
DATA -> FILENAME Write() CONN
DATA -> FILENAME Write() DATA
DATA -> FILENAME Write() DISC
DATA -> IN Read() CONN
DATA -> IN Read() DATA
DATA -> IN Read() DISC
DATA -> ENCODING Read() CONN
DATA -> ENCODING Read() DATA
DATA -> ENCODING Read() DISC

Would anyone be so kind to advise how can I debug it?


Solution

  • The problem is that csv/ConvertCsvToMatrix is not sending disconnect on its output port. This causes NoFlo to believe that the network is not done running yet, so the process is not shutdown. Both of the .send() calls in the component must be followed by a .disconnect() call.

    This can be seen from the --debug output in that it ends with: ParseCSV() OUT -> IN Write() CONN ParseCSV() OUT -> IN Write() DATA

    Compare with the successful example which ends with DATA -> ENCODING Read() DISC