Совместная работа Django_dramatiq и Redis
Однажды запущенная задача исполняется многократно.
logger = logging.getLogger('dramatiq')
@dramatiq.actor
def my_test():
logger.debug("Starting big_test task")
auto = AutoTest()
logger.debug("AutoTest instance created")
auto.big_test2()
logger.debug(f"big_test2 done")
return
Очереди принудительно чищу, все сервисы перезапускаю.
Из логфайла видно что сообщение возникает многократно хотя запуск был один
DEBUG 2024-07-04 14:11:39,250 worker Running worker thread...
DEBUG 2024-07-04 14:11:39,252 worker Running worker thread...
INFO 2024-07-04 14:11:39,257 cli Worker process is ready for action.
DEBUG 2024-07-04 14:12:33,474 redis Enqueueing message '1190064f-c814-4cb5-9d50-57d2e5d39bd4' on queue 'default'.
DEBUG 2024-07-04 14:12:33,679 worker Pushing message '1190064f-c814-4cb5-9d50-57d2e5d39bd4' onto work queue.
DEBUG 2024-07-04 14:12:33,680 worker Received message my_test() with id '1190064f-c814-4cb5-9d50-57d2e5d39bd4'.
DEBUG 2024-07-04 14:12:33,924 test Starting big_test task
INFO 2024-07-04 14:12:42,576 test driver up
DEBUG 2024-07-04 14:12:42,576 test AutoTest instance created
DEBUG 2024-07-04 14:12:42,576 test go2
DEBUG 2024-07-04 14:12:45,125 test go2
DEBUG 2024-07-04 14:12:45,950 test go2
DEBUG 2024-07-04 14:12:46,703 test go2
DEBUG 2024-07-04 14:12:46,716 redis Enqueueing message '18691264-8140-44c0-8886-91dad973f038' on queue 'default'.
DEBUG 2024-07-04 14:12:46,765 worker Pushing message '18691264-8140-44c0-8886-91dad973f038' onto work queue.
DEBUG 2024-07-04 14:12:46,766 worker Received message my_test() with id '18691264-8140-44c0-8886-91dad973f038'.
DEBUG 2024-07-04 14:12:46,998 test Starting big_test task
DEBUG 2024-07-04 14:12:47,019 redis Enqueueing message 'a4e67d93-29ae-47c3-bad5-93cc0bf6a267' on queue 'default'.
DEBUG 2024-07-04 14:12:47,036 worker Pushing message 'a4e67d93-29ae-47c3-bad5-93cc0bf6a267' onto work queue.
DEBUG 2024-07-04 14:12:47,037 worker Received message my_test() with id 'a4e67d93-29ae-47c3-bad5-93cc0bf6a267'.
DEBUG 2024-07-04 14:12:47,252 test go2
DEBUG 2024-07-04 14:12:47,324 test Starting big_test task
DEBUG 2024-07-04 14:12:49,992 test go2
DEBUG 2024-07-04 14:12:54,264 test go2