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

db_storage datetime handling #20

Open
mlinvill opened this issue May 25, 2021 · 1 comment
Open

db_storage datetime handling #20

mlinvill opened this issue May 25, 2021 · 1 comment

Comments

@mlinvill
Copy link

Description

There have been a few snews app crashes over the last two days. See the most recent stack trace for details.

Stack Trace

...

2021-05-25 09:55:18,852 | model : INFO : starting decider
2021-05-25 09:55:18,853 | model : INFO : processing messages from kafka://kafka.scimma.org/snews.experiments-test
2021-05-25 09:56:30,862 | model : DEBUG : read message from partition 7
2021-05-25 09:56:30,863 | model : DEBUG : processing SNEWSObservation
2021-05-25 09:56:30,863 | model : INFO : shutting down
2021-05-25 09:56:30,866 | model : DEBUG : shutting down producer
2021-05-25 09:56:30,867 | model : DEBUG : flushed all messages
Traceback (most recent call last):
File "/depot/darkmatter/apps/snews/sandbox/snews-venv/bin/snews", line 8, in
sys.exit(main())
File "/depot/darkmatter/apps/snews/sandbox/snews-venv/lib/python3.7/site-packages/snews/main.py", line 53, in main
args.func(args)
File "/depot/darkmatter/apps/snews/sandbox/snews-venv/lib/python3.7/site-packages/snews/model.py", line 169, in main
model.run()
File "/depot/darkmatter/apps/snews/sandbox/snews-venv/lib/python3.7/site-packages/snews/model.py", line 115, in run
self.processMessage(msg)
File "/depot/darkmatter/apps/snews/sandbox/snews-venv/lib/python3.7/site-packages/snews/model.py", line 134, in processMessage
self.mapping[message_type](message)
File "/depot/darkmatter/apps/snews/sandbox/snews-venv/lib/python3.7/site-packages/snews/model.py", line 137, in processObservationMessage
self.addObservationMsg(message)
File "/depot/darkmatter/apps/snews/sandbox/snews-venv/lib/python3.7/site-packages/snews/model.py", line 128, in addObservationMsg
self.myDecider.addMessage(message)
File "/depot/darkmatter/apps/snews/sandbox/snews-venv/lib/python3.7/site-packages/snews/decider.py", line 54, in addMessage
self.db.insert(message.sent_time, message.neutrino_time, message.asdict())
File "/depot/darkmatter/apps/snews/sandbox/snews-venv/lib/python3.7/site-packages/snews/db_storage.py", line 42, in insert
time2 = datetime.datetime.strptime(sent_time, self.datetime_format)
TypeError: strptime() argument 1 must be str, not int

@mlinvill
Copy link
Author

mlinvill commented Jun 3, 2021

I caught an offending observation message in the wild today. This message definitely triggered a snews app crash with a similar stack trace as previously reported. Perhaps a fix is as simple as not bothering to insert() messages with sent_time or neutrino_time of 0?

$ hop subscribe  $OBSERVATION_TOPIC --persist
SNEWSObservation(message_id=0, detector_id=0, sent_time=0, neutrino_time=0, machine_time=0, location='test', p_value=0, status='test', content='test')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant