Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add time guard to filesource to allow unprocessed messages to be deli… #1272

Merged
merged 1 commit into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker/Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libvulkan-dev \
python3-numpy
WORKDIR /root
RUN git clone https://github.com/iqtlabs/gr-iqtlabs -b 1.0.101
RUN git clone https://github.com/iqtlabs/gr-iqtlabs -b 1.0.102
COPY --from=iqtlabs/gamutrf-vkfft:latest /root /root/gr-iqtlabs
WORKDIR /root/gr-iqtlabs/build
COPY --from=iqtlabs/gamutrf-sigmf:latest /usr/local /usr/local
Expand Down
11 changes: 11 additions & 0 deletions gamutrf/grsource.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
int(self.n_samples / self.tagged_interval) * self.tagged_interval
)
logging.info("opened %s with %u samples", input_file, self.n_samples)
self.work_guard = None

def complete(self):
return self.i >= self.n_samples
Expand Down Expand Up @@ -115,8 +116,18 @@

def general_work(self, input_items, output_items):
if self.complete():
# gnuradio will drop all undelivered messages to blocks when our source
# returns done. cause gnuradio to repeatedly call us when we're done, to
# give other blocks an opportunity to process undelivered messages.
if self.work_guard is None:
self.work_guard = time.time()
logging.info("file ended, waiting for other blocks to finish")
return 0
if time.time() - self.work_guard < 3:
return 0

Check warning on line 127 in gamutrf/grsource.py

View check run for this annotation

Codecov / codecov/patch

gamutrf/grsource.py#L122-L127

Added lines #L122 - L127 were not covered by tests
logging.info("complete")
return -1

n = min(self.nfft, len(output_items[0]))
samples = self.samples[self.i : self.i + n]
c = len(samples)
Expand Down
Loading