2016-11-30 118 views
0

我試圖運行一些簡單的圖形,使用noflo-filesystemnoflo-csv讀取CSV文件,解析並將其寫入文件。 問題是程序等待的東西,我不知道如何提供:noflo無法關閉執行

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 

當我運行

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

我得到:

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 

然後程序掛起。

我試圖IN端口養活Write的使用就像一個字符串:

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

而且這工作得很好:

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 

會有人這麼好心勸我怎麼能調試它?

回答

1

問題是csv/ConvertCsvToMatrix未在其輸出端口上發送disconnect。這會導致NoFlo認爲網絡尚未運行,因此該過程未關閉。撥打.send()的電話the component後面必須跟一個.disconnect()呼叫。 ParseCSV() OUT -> IN Write() CONN ParseCSV() OUT -> IN Write() DATA

與結束與 DATA -> ENCODING Read() DISC

1

隨着NoFlo 0.8,我們不希望看到一個新的方法成功的例子比較:

這可以從--debug輸出,它與結尾可以看到哪些進程保持網絡活着:

network.getActiveProcesses返回當前活動進程的進程ID數組。

這對查找行爲不好的組件很有用。