Open c-goosen opened 4 years ago
with db.transaction.atomic(using=Schedule.objects.db):
for s in (
Schedule.objects.select_for_update()
.exclude(repeats=0)
.filter(next_run__lt=timezone.now())
):
I'm guessing it can't find the db for the Schedule model in the db router. Did you use set the db for the Schedule in the router or just set the ORM setting?
If I'm right and you want all of the django_q models to run on a seperate database, not just the queue, then we would have to implement db selection in the model managers and the admins.
Hello, please consider giving a look on #434 .
I had split correctly the default database from the django_q and was having the same problem. Found out was using an older version (1.2.1) and it was fixed on 1.2.2 .
Duplicate of #434
Getting the following output on a Multi DB setup.
Version: 3.1.1 Python Version: Python 3.8.3
ENV: Amazon Linux on AWS EKS Fargate
23:43:37 [Q] INFO Q Cluster bravo-wyoming-idaho-minnesota running. 23:44:08 [Q] ERROR select_for_update cannot be used outside of a transaction. 23:44:39 [Q] ERROR select_for_update cannot be used outside of a transaction. 23:45:10 [Q] ERROR select_for_update cannot be used outside of a transaction. 23:45:27 [Q] INFO Process-1:1 processing [red-fruit-princess-potato] 23:45:40 [Q] ERROR select_for_update cannot be used outside of a transaction.
Investigating some more. Will replicate locally.
Currently fixed it by having separate settings from ENV vars for django-q containers.
Any ideas?