Cannot mark observations as seen
Closed this issue · 3 comments
niconoe commented
This happens on both dev and production server, but cannot replicate on my dev machine yet.
The worker queue starts normally, then the following exception happens:
Traceback (most recent call last):
File "/home/ubuntu/.cache/pypoetry/virtualenvs/riparias-early-warning-webapp-Gz5dE7VP-py3.9/lib/python3.9/site-packages/rq/worker.py", line 1061, in perform_job
job.set_status(JobStatus.FINISHED, pipeline=pipeline)
File "/home/ubuntu/.cache/pypoetry/virtualenvs/riparias-early-warning-webapp-Gz5dE7VP-py3.9/lib/python3.9/site-packages/rq/job.py", line 821, in perform
job_class=self.__class__,
File "/home/ubuntu/.cache/pypoetry/virtualenvs/riparias-early-warning-webapp-Gz5dE7VP-py3.9/lib/python3.9/site-packages/rq/job.py", line 844, in _execute
from .queue import Queue
File "/home/ubuntu/early-warning-webapp/dashboard/views/jobs.py", line 11, in mark_many_observations_as_seen
observation.mark_as_seen_by(user)
File "/home/ubuntu/early-warning-webapp/dashboard/models.py", line 248, in mark_as_seen_by
objects = ObservationManager()
File "/home/ubuntu/.cache/pypoetry/virtualenvs/riparias-early-warning-webapp-Gz5dE7VP-py3.9/lib/python3.9/site-packages/django/db/models/manager.py", line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/home/ubuntu/.cache/pypoetry/virtualenvs/riparias-early-warning-webapp-Gz5dE7VP-py3.9/lib/python3.9/site-packages/django/db/models/query.py", line 492, in get
else self.model._base_manager.filter(pk__in=self.values("pk"))
File "/home/ubuntu/.cache/pypoetry/virtualenvs/riparias-early-warning-webapp-Gz5dE7VP-py3.9/lib/python3.9/site-packages/django/db/models/query.py", line 302, in __len__
self._fields = None
File "/home/ubuntu/.cache/pypoetry/virtualenvs/riparias-early-warning-webapp-Gz5dE7VP-py3.9/lib/python3.9/site-packages/django/db/models/query.py", line 1507, in _fetch_all
FOR UPDATE lock.
File "/home/ubuntu/.cache/pypoetry/virtualenvs/riparias-early-warning-webapp-Gz5dE7VP-py3.9/lib/python3.9/site-packages/django/db/models/query.py", line 57, in __iter__
return list(islice(gen, self.chunk_size))
File "/home/ubuntu/.cache/pypoetry/virtualenvs/riparias-early-warning-webapp-Gz5dE7VP-py3.9/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 1385, in execute_sql
sql, params = self.as_sql()
File "/home/ubuntu/.cache/pypoetry/virtualenvs/riparias-early-warning-webapp-Gz5dE7VP-py3.9/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 593, in as_sql
extra_select, order_by, group_by = self.pre_sql_setup()
File "/home/ubuntu/.cache/pypoetry/virtualenvs/riparias-early-warning-webapp-Gz5dE7VP-py3.9/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 71, in pre_sql_setup
self.setup_query()
File "/home/ubuntu/.cache/pypoetry/virtualenvs/riparias-early-warning-webapp-Gz5dE7VP-py3.9/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 62, in setup_query
self.select, self.klass_info, self.annotation_col_map = self.get_select()
File "/home/ubuntu/.cache/pypoetry/virtualenvs/riparias-early-warning-webapp-Gz5dE7VP-py3.9/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 257, in get_select
cols = self.get_default_columns()
File "/home/ubuntu/.cache/pypoetry/virtualenvs/riparias-early-warning-webapp-Gz5dE7VP-py3.9/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 818, in get_default_columns
only_load = self.deferred_to_columns()
File "/home/ubuntu/.cache/pypoetry/virtualenvs/riparias-early-warning-webapp-Gz5dE7VP-py3.9/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 1316, in deferred_to_columns
self.query.deferred_to_data(columns)
TypeError: deferred_to_data() missing 1 required positional argument: 'callback'
niconoe commented
Update: apparently, this obscure error disappear after restarting the rq worker. This should probably be done on each deployment anyway. Will fix the deployment scripts!
niconoe commented
Deployment scripts updated, it appears to work fine.
I'll double-check in a couple of days, just to be sure the problem is 100% fixed!
niconoe commented
Works fine in production.