Dear all,
I am currently trying to create a Flowgraph, which only runs once and
then quits. When using Streams and Custom Python Blocks, I am able to
create a Flowgraph that completes and exits completely.
I select the Run Options in the Option Block to "Run to Completion" and
use the function `gr.block.consume_each()` to notify the scheduler about
the consumed Samples.
Now I want to do the same while only utilizing Message Passing. My
minimal example consists of a self written File Source Block and a self
written save to file Block. For the implementation of the File Source I
used threading. This works, but the Flowgraph never completes, I suspect
that the thread still continues to run in the background.
I have created another Flowgraph, which uses the standard File Source,
then converts the stream to a message and finally saves it with my self
written save to file block. This Flowgraph completes fine, so I do not
think that the Save to File Block is the issue.
My question now is, how can I write a Python Block, which runs only once
(similar to the standard File Source with Repeat=No) that reads a file
and outputs it on a message port? How can I tell the scheduler, that all
messages have been consumed?
Here is my current File Source which uses threading:
https://pastebin.com/6pNVgfPS
Thanks for looking into this and kind regards,
Patric Müller
No comments:
Post a Comment