How to initialize channel from CSV file but only after CSV file created? #2154
-
I'm trying to do something relatively simple - have one process produce a CSV file (external to the work directory), then, feed the CSV rows into another channel after the first process is completed. Process A runs a python script which generates a CSV file in some absolute file path say "/mnt/x/blah.csv". Process B needs to consume the CSV file line by line, after process A has finished. The trouble is that the channel to input to B is initialized at the beginning before "/mnt/x/blah.csv" is created by A so it fails. This occurs even if I collect the result of process A as input to process B (because channel is initialized regardless)
This fails immediately with "No such file: /mnt/x/blah.csv" because the channel is initialized before process_a has even started. Same behavior occurs when using concat:
Question:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @bhpersonal , I know you asked this a while ago, but I'll answer for the edification of anyone who comes across this post. Ideally, you should output the csv file as an output channel in process_a, then you can pass that channel to process_b. That way, process_b will start only after process_a is done, and it will receive the csv file directly to its folder. Meanwhile you can publish the csv file from process_a to an output folder if you want. Alternatively, you can pass the "ready" channel you made for process_a to process_b as an input, and that will at least ensure that process_b waits for process_a. But really you should do the first thing I suggested. |
Beta Was this translation helpful? Give feedback.
Hi @bhpersonal , I know you asked this a while ago, but I'll answer for the edification of anyone who comes across this post.
Ideally, you should output the csv file as an output channel in process_a, then you can pass that channel to process_b. That way, process_b will start only after process_a is done, and it will receive the csv file directly to its folder. Meanwhile you can publish the csv file from process_a to an output folder if you want.
Alternatively, you can pass the "ready" channel you made for process_a to process_b as an input, and that will at least ensure that process_b waits for process_a. But really you should do the first thing I suggested.