mirror of
https://github.com/craigerl/aprsd.git
synced 2024-11-23 00:18:39 -05:00
Compare commits
3 Commits
d863474c13
...
7dc0aee9e6
Author | SHA1 | Date | |
---|---|---|---|
7dc0aee9e6 | |||
3fd606946d | |||
|
fbfac97140 |
@ -14,7 +14,10 @@ from aprsd.main import cli
|
||||
|
||||
|
||||
os.environ["APRSD_ADMIN_COMMAND"] = "1"
|
||||
from aprsd import wsgi as aprsd_wsgi
|
||||
# this import has to happen AFTER we set the
|
||||
# above environment variable, so that the code
|
||||
# inside the wsgi.py has the value
|
||||
from aprsd import wsgi as aprsd_wsgi # noqa
|
||||
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
@ -135,14 +135,21 @@ class ListenStatsThread(APRSDThread):
|
||||
if self.loop_count % 10 == 0:
|
||||
# log the stats every 10 seconds
|
||||
stats_json = collector.Collector().collect()
|
||||
stats = stats_json["SimplePacketStats"]
|
||||
total_rx = stats["total_rx"]
|
||||
stats = stats_json["PacketList"]
|
||||
total_rx = stats["rx"]
|
||||
rate = (total_rx - self._last_total_rx) / 10
|
||||
LOG.warning(f"RX Rate: {rate} pps Total RX: {total_rx} - {self._last_total_rx}")
|
||||
#LOG.error(stats)
|
||||
LOGU.opt(colors=True).info(
|
||||
f"<green>RX Rate: {rate} pps</green> "
|
||||
f"<yellow>Total RX: {total_rx}</yellow> "
|
||||
f"<red>RX Last 10 secs: {total_rx - self._last_total_rx}</red>",
|
||||
)
|
||||
self._last_total_rx = total_rx
|
||||
for k, v in stats["types"].items():
|
||||
LOGU.opt(colors=True).warning(f"Type: {k} <blue>RX: {v['rx']}</blue> <red>TX: {v['tx']}</red>")
|
||||
thread_hex = f"fg {utils.hex_from_name(k)}"
|
||||
LOGU.opt(colors=True).info(
|
||||
f"<{thread_hex}>{k:<15}</{thread_hex}> "
|
||||
f"<blue>RX: {v['rx']}</blue> <red>TX: {v['tx']}</red>",
|
||||
)
|
||||
|
||||
time.sleep(1)
|
||||
return True
|
||||
@ -261,26 +268,23 @@ def listen(
|
||||
# just deregister the class from the packet collector
|
||||
packet_collector.PacketCollector().unregister(seen_list.SeenList)
|
||||
|
||||
packet_collector.PacketCollector().register(SimplePacketStats)
|
||||
|
||||
from aprsd.client import stats as client_stats
|
||||
from aprsd.packets.packet_list import PacketList # noqa: F401
|
||||
from aprsd.packets.seen_list import SeenList # noqa: F401
|
||||
from aprsd.packets.tracker import PacketTrack # noqa: F401
|
||||
from aprsd.packets.watch_list import WatchList # noqa: F401
|
||||
from aprsd.plugins import email
|
||||
from aprsd.threads import aprsd as aprsd_thread
|
||||
c = collector.Collector()
|
||||
# c.unregister_producer(app.APRSDStats)
|
||||
c.unregister_producer(PacketList)
|
||||
c.unregister_producer(WatchList)
|
||||
#c.unregister_producer(PacketTrack)
|
||||
c.unregister_producer(plugin.PluginManager)
|
||||
c.unregister_producer(aprsd_thread.APRSDThreadList)
|
||||
c.unregister_producer(email.EmailStats)
|
||||
c.unregister_producer(client_stats.APRSClientStats)
|
||||
c.unregister_producer(seen_list.SeenList)
|
||||
c.register_producer(SimplePacketStats)
|
||||
# from aprsd.client import stats as client_stats
|
||||
# from aprsd.packets.packet_list import PacketList # noqa: F401
|
||||
# from aprsd.packets.seen_list import SeenList # noqa: F401
|
||||
# from aprsd.packets.tracker import PacketTrack # noqa: F401
|
||||
# from aprsd.packets.watch_list import WatchList # noqa: F401
|
||||
# from aprsd.plugins import email
|
||||
# from aprsd.threads import aprsd as aprsd_thread
|
||||
# c = collector.Collector()
|
||||
# # c.unregister_producer(app.APRSDStats)
|
||||
# c.unregister_producer(PacketList)
|
||||
# c.unregister_producer(WatchList)
|
||||
# #c.unregister_producer(PacketTrack)
|
||||
# c.unregister_producer(plugin.PluginManager)
|
||||
# c.unregister_producer(aprsd_thread.APRSDThreadList)
|
||||
# c.unregister_producer(email.EmailStats)
|
||||
# c.unregister_producer(client_stats.APRSClientStats)
|
||||
# c.unregister_producer(seen_list.SeenList)
|
||||
|
||||
pm = None
|
||||
pm = plugin.PluginManager()
|
||||
|
@ -89,6 +89,9 @@ def _send_direct(packet, aprs_client=None):
|
||||
except Exception as e:
|
||||
LOG.error(f"Failed to send packet: {packet}")
|
||||
LOG.error(e)
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
|
||||
class SendPacketThread(aprsd_threads.APRSDThread):
|
||||
@ -150,8 +153,17 @@ class SendPacketThread(aprsd_threads.APRSDThread):
|
||||
# no attempt time, so lets send it, and start
|
||||
# tracking the time.
|
||||
packet.last_send_time = int(round(time.time()))
|
||||
_send_direct(packet)
|
||||
packet.send_count += 1
|
||||
sent = False
|
||||
try:
|
||||
sent = _send_direct(packet)
|
||||
except Exception:
|
||||
LOG.error(f"Failed to send packet: {packet}")
|
||||
else:
|
||||
# If an exception happens while sending
|
||||
# we don't want this attempt to count
|
||||
# against the packet
|
||||
if sent:
|
||||
packet.send_count += 1
|
||||
|
||||
time.sleep(1)
|
||||
# Make sure we get called again.
|
||||
@ -199,8 +211,18 @@ class SendAckThread(aprsd_threads.APRSDThread):
|
||||
send_now = True
|
||||
|
||||
if send_now:
|
||||
_send_direct(self.packet)
|
||||
self.packet.send_count += 1
|
||||
sent = False
|
||||
try:
|
||||
sent = _send_direct(self.packet)
|
||||
except Exception:
|
||||
LOG.error(f"Failed to send packet: {self.packet}")
|
||||
else:
|
||||
# If an exception happens while sending
|
||||
# we don't want this attempt to count
|
||||
# against the packet
|
||||
if sent:
|
||||
self.packet.send_count += 1
|
||||
|
||||
self.packet.last_send_time = int(round(time.time()))
|
||||
|
||||
time.sleep(1)
|
||||
|
@ -269,7 +269,6 @@ def init_app(config_file=None, log_level=None):
|
||||
|
||||
return log_level
|
||||
|
||||
print(f"__name__ = {__name__}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
async_mode = "threading"
|
||||
|
225
requirements.txt
225
requirements.txt
@ -4,69 +4,162 @@
|
||||
#
|
||||
# pip-compile --annotation-style=line requirements.in
|
||||
#
|
||||
aprslib==0.7.2 # via -r requirements.in
|
||||
attrs==24.2.0 # via ax253, kiss3, rush
|
||||
ax253==0.1.5.post1 # via kiss3
|
||||
beautifulsoup4==4.12.3 # via -r requirements.in
|
||||
bidict==0.23.1 # via python-socketio
|
||||
bitarray==3.0.0 # via ax253, kiss3
|
||||
blinker==1.8.2 # via flask
|
||||
certifi==2024.8.30 # via requests
|
||||
charset-normalizer==3.4.0 # via requests
|
||||
click==8.1.7 # via -r requirements.in, click-params, flask
|
||||
click-params==0.5.0 # via -r requirements.in
|
||||
commonmark==0.9.1 # via rich
|
||||
dataclasses==0.6 # via -r requirements.in
|
||||
dataclasses-json==0.6.7 # via -r requirements.in
|
||||
debtcollector==3.0.0 # via oslo-config
|
||||
deprecated==1.2.14 # via click-params
|
||||
flask==3.0.3 # via -r requirements.in, flask-httpauth, flask-socketio
|
||||
flask-httpauth==4.8.0 # via -r requirements.in
|
||||
flask-socketio==5.4.1 # via -r requirements.in
|
||||
geographiclib==2.0 # via geopy
|
||||
geopy==2.4.1 # via -r requirements.in
|
||||
h11==0.14.0 # via wsproto
|
||||
idna==3.10 # via requests
|
||||
imapclient==3.0.1 # via -r requirements.in
|
||||
importlib-metadata==8.5.0 # via ax253, kiss3
|
||||
itsdangerous==2.2.0 # via flask
|
||||
jinja2==3.1.4 # via flask
|
||||
kiss3==8.0.0 # via -r requirements.in
|
||||
loguru==0.7.2 # via -r requirements.in
|
||||
markupsafe==3.0.2 # via jinja2, werkzeug
|
||||
marshmallow==3.23.0 # via dataclasses-json
|
||||
mypy-extensions==1.0.0 # via typing-inspect
|
||||
netaddr==1.3.0 # via oslo-config
|
||||
oslo-config==9.6.0 # via -r requirements.in
|
||||
oslo-i18n==6.4.0 # via oslo-config
|
||||
packaging==24.1 # via marshmallow
|
||||
pbr==6.1.0 # via oslo-i18n, stevedore
|
||||
pluggy==1.5.0 # via -r requirements.in
|
||||
pygments==2.18.0 # via rich
|
||||
pyserial==3.5 # via pyserial-asyncio
|
||||
pyserial-asyncio==0.6 # via kiss3
|
||||
python-engineio==4.10.1 # via python-socketio
|
||||
python-socketio==5.11.4 # via -r requirements.in, flask-socketio
|
||||
pytz==2024.2 # via -r requirements.in
|
||||
pyyaml==6.0.2 # via -r requirements.in, oslo-config
|
||||
requests==2.32.3 # via -r requirements.in, oslo-config, update-checker
|
||||
rfc3986==2.0.0 # via oslo-config
|
||||
rich==12.6.0 # via -r requirements.in
|
||||
rush==2021.4.0 # via -r requirements.in
|
||||
shellingham==1.5.4 # via -r requirements.in
|
||||
simple-websocket==1.1.0 # via python-engineio
|
||||
six==1.16.0 # via -r requirements.in
|
||||
soupsieve==2.6 # via beautifulsoup4
|
||||
stevedore==5.3.0 # via oslo-config
|
||||
tabulate==0.9.0 # via -r requirements.in
|
||||
thesmuggler==1.0.1 # via -r requirements.in
|
||||
typing-extensions==4.12.2 # via typing-inspect
|
||||
typing-inspect==0.9.0 # via dataclasses-json
|
||||
tzlocal==5.2 # via -r requirements.in
|
||||
update-checker==0.18.0 # via -r requirements.in
|
||||
urllib3==2.2.3 # via requests
|
||||
validators==0.22.0 # via click-params
|
||||
werkzeug==3.0.4 # via flask
|
||||
wrapt==1.16.0 # via -r requirements.in, debtcollector, deprecated
|
||||
wsproto==1.2.0 # via simple-websocket
|
||||
zipp==3.20.2 # via importlib-metadata
|
||||
aprslib==0.7.2
|
||||
# via -r requirements.in
|
||||
attrs==24.2.0
|
||||
# via
|
||||
# ax253
|
||||
# kiss3
|
||||
# rush
|
||||
ax253==0.1.5.post1
|
||||
# via kiss3
|
||||
beautifulsoup4==4.12.3
|
||||
# via -r requirements.in
|
||||
bidict==0.23.1
|
||||
# via python-socketio
|
||||
bitarray==3.0.0
|
||||
# via
|
||||
# ax253
|
||||
# kiss3
|
||||
blinker==1.8.2
|
||||
# via flask
|
||||
certifi==2024.8.30
|
||||
# via requests
|
||||
charset-normalizer==3.4.0
|
||||
# via requests
|
||||
click==8.1.7
|
||||
# via
|
||||
# -r requirements.in
|
||||
# click-params
|
||||
# flask
|
||||
click-params==0.5.0
|
||||
# via -r requirements.in
|
||||
commonmark==0.9.1
|
||||
# via rich
|
||||
dataclasses==0.6
|
||||
# via -r requirements.in
|
||||
dataclasses-json==0.6.7
|
||||
# via -r requirements.in
|
||||
debtcollector==3.0.0
|
||||
# via oslo-config
|
||||
deprecated==1.2.14
|
||||
# via click-params
|
||||
flask==3.0.3
|
||||
# via
|
||||
# -r requirements.in
|
||||
# flask-httpauth
|
||||
# flask-socketio
|
||||
flask-httpauth==4.8.0
|
||||
# via -r requirements.in
|
||||
flask-socketio==5.4.1
|
||||
# via -r requirements.in
|
||||
geographiclib==2.0
|
||||
# via geopy
|
||||
geopy==2.4.1
|
||||
# via -r requirements.in
|
||||
h11==0.14.0
|
||||
# via wsproto
|
||||
idna==3.10
|
||||
# via requests
|
||||
imapclient==3.0.1
|
||||
# via -r requirements.in
|
||||
importlib-metadata==8.5.0
|
||||
# via
|
||||
# ax253
|
||||
# kiss3
|
||||
itsdangerous==2.2.0
|
||||
# via flask
|
||||
jinja2==3.1.4
|
||||
# via flask
|
||||
kiss3==8.0.0
|
||||
# via -r requirements.in
|
||||
loguru==0.7.2
|
||||
# via -r requirements.in
|
||||
markupsafe==3.0.2
|
||||
# via
|
||||
# jinja2
|
||||
# werkzeug
|
||||
marshmallow==3.23.0
|
||||
# via dataclasses-json
|
||||
mypy-extensions==1.0.0
|
||||
# via typing-inspect
|
||||
netaddr==1.3.0
|
||||
# via oslo-config
|
||||
oslo-config==9.6.0
|
||||
# via -r requirements.in
|
||||
oslo-i18n==6.4.0
|
||||
# via oslo-config
|
||||
packaging==24.1
|
||||
# via marshmallow
|
||||
pbr==6.1.0
|
||||
# via
|
||||
# oslo-i18n
|
||||
# stevedore
|
||||
pluggy==1.5.0
|
||||
# via -r requirements.in
|
||||
pygments==2.18.0
|
||||
# via rich
|
||||
pyserial==3.5
|
||||
# via pyserial-asyncio
|
||||
pyserial-asyncio==0.6
|
||||
# via kiss3
|
||||
python-engineio==4.10.1
|
||||
# via python-socketio
|
||||
python-socketio==5.11.4
|
||||
# via
|
||||
# -r requirements.in
|
||||
# flask-socketio
|
||||
pytz==2024.2
|
||||
# via -r requirements.in
|
||||
pyyaml==6.0.2
|
||||
# via
|
||||
# -r requirements.in
|
||||
# oslo-config
|
||||
requests==2.32.3
|
||||
# via
|
||||
# -r requirements.in
|
||||
# oslo-config
|
||||
# update-checker
|
||||
rfc3986==2.0.0
|
||||
# via oslo-config
|
||||
rich==12.6.0
|
||||
# via -r requirements.in
|
||||
rush==2021.4.0
|
||||
# via -r requirements.in
|
||||
shellingham==1.5.4
|
||||
# via -r requirements.in
|
||||
simple-websocket==1.1.0
|
||||
# via python-engineio
|
||||
six==1.16.0
|
||||
# via -r requirements.in
|
||||
soupsieve==2.6
|
||||
# via beautifulsoup4
|
||||
stevedore==5.3.0
|
||||
# via oslo-config
|
||||
tabulate==0.9.0
|
||||
# via -r requirements.in
|
||||
thesmuggler==1.0.1
|
||||
# via -r requirements.in
|
||||
typing-extensions==4.12.2
|
||||
# via typing-inspect
|
||||
typing-inspect==0.9.0
|
||||
# via dataclasses-json
|
||||
tzlocal==5.2
|
||||
# via -r requirements.in
|
||||
update-checker==0.18.0
|
||||
# via -r requirements.in
|
||||
urllib3==2.2.3
|
||||
# via requests
|
||||
validators==0.22.0
|
||||
# via click-params
|
||||
werkzeug==3.0.6
|
||||
# via flask
|
||||
wrapt==1.16.0
|
||||
# via
|
||||
# -r requirements.in
|
||||
# debtcollector
|
||||
# deprecated
|
||||
wsproto==1.2.0
|
||||
# via simple-websocket
|
||||
zipp==3.20.2
|
||||
# via importlib-metadata
|
||||
|
Loading…
Reference in New Issue
Block a user