Friday, June 5, 2020

message passing issue in systemd context

#!/usr/bin/env python2
# -*- coding: utf-8 -*-
##################################################
# GNU Radio Python Flow Graph
# Title: Msgtest
# GNU Radio version: 3.7.13.5
##################################################

from gnuradio import blocks
from gnuradio import eng_notation
from gnuradio import gr
from gnuradio.eng_option import eng_option
from gnuradio.filter import firdes
from optparse import OptionParser
import pmt


class msgtest(gr.top_block):

def __init__(self):
gr.top_block.__init__(self, "Msgtest")

##################################################
# Variables
##################################################
self.samp_rate = samp_rate = 32000

##################################################
# Blocks
##################################################
self.blocks_message_strobe_0 = blocks.message_strobe(pmt.intern("TEST"), 1000)
self.blocks_message_debug_0 = blocks.message_debug()

##################################################
# Connections
##################################################
self.msg_connect((self.blocks_message_strobe_0, 'strobe'), (self.blocks_message_debug_0, 'print'))

def get_samp_rate(self):
return self.samp_rate

def set_samp_rate(self, samp_rate):
self.samp_rate = samp_rate


def main(top_block_cls=msgtest, options=None):

tb = top_block_cls()
tb.start()
try:
raw_input('Press Enter to quit: ')
except EOFError:
pass
tb.stop()
tb.wait()


if __name__ == '__main__':
main()
[Unit]
Description=Message passing flowgraph
After=network-online.target

[Service]
Restart=always
RestartSec=3
EnvironmentFile=/etc/environment
User=dev
Type=simple
ExecStart=/usr/bin/python /home/dev/src/gr-sapp/examples/msgtest.py

[Install]
WantedBy=multi-user.target

Hi.

I am having issues running gnuradio flowgraphs containg message passing in a systemd context.

I have tried running a minimal flowgraph only containing a message strobe and a message debug block.
When I run it manually it works just fine, but when executed from a systemd service the flowgraph restarts all the time.

Here is some cutouts from journalctl:

-- Logs begin at Wed 2019-01-02 04:42:01 CET, end at Fri 2020-06-05 11:12:21 CEST. --
jun 05 11:12:13 fitlet2-001 python[32548]: Press Enter to quit:
jun 05 11:12:12 fitlet2-001 systemd[1]: Started Message passing flowgraph.
jun 05 11:12:12 fitlet2-001 systemd[1]: Stopped Message passing flowgraph.
jun 05 11:12:12 fitlet2-001 systemd[1]: msgtest.service: Scheduled restart job, restart counter is at 4.
jun 05 11:12:12 fitlet2-001 systemd[1]: msgtest.service: Service hold-off time over, scheduling restart.
jun 05 11:12:09 fitlet2-001 python[32532]: Press Enter to quit:
jun 05 11:12:09 fitlet2-001 systemd[1]: Started Message passing flowgraph.
jun 05 11:12:09 fitlet2-001 systemd[1]: Stopped Message passing flowgraph.
jun 05 11:12:09 fitlet2-001 systemd[1]: msgtest.service: Scheduled restart job, restart counter is at 3.
jun 05 11:12:09 fitlet2-001 systemd[1]: msgtest.service: Service hold-off time over, scheduling restart.
jun 05 11:12:05 fitlet2-001 python[32514]: Press Enter to quit:
jun 05 11:12:05 fitlet2-001 systemd[1]: Started Message passing flowgraph.
jun 05 11:12:05 fitlet2-001 systemd[1]: Stopped Message passing flowgraph.
jun 05 11:12:05 fitlet2-001 systemd[1]: msgtest.service: Scheduled restart job, restart counter is at 2.
jun 05 11:12:05 fitlet2-001 systemd[1]: msgtest.service: Service hold-off time over, scheduling restart.
jun 05 11:12:02 fitlet2-001 python[32496]: Press Enter to quit:
jun 05 11:12:01 fitlet2-001 systemd[1]: Started Message passing flowgraph.
jun 05 11:12:01 fitlet2-001 systemd[1]: Stopped Message passing flowgraph.
jun 05 11:12:01 fitlet2-001 systemd[1]: msgtest.service: Scheduled restart job, restart counter is at 1.
jun 05 11:12:01 fitlet2-001 systemd[1]: msgtest.service: Service hold-off time over, scheduling restart.
jun 05 11:11:58 fitlet2-001 python[32481]: Press Enter to quit:
jun 05 11:11:57 fitlet2-001 systemd[1]: Started Message passing flowgraph.

I an running Gnuradio 3.7.13.4 on Ubuntu 18.04.1 LTS

I have attached the flowgraph, systemd unit file and the /etc/environment setup file.


Thank you for any assistance!

Regards, Victor

No comments:

Post a Comment