dramatiq
dramatiq copied to clipboard
Misleading docs for integration with apscheduler
What OS are you using?
OS not related
What version of Dramatiq are you using?
1.14.1
What did you do?
I used example from https://dramatiq.io/cookbook.html#scheduling-messages:
import dramatiq
import sys
from apscheduler.schedulers.blocking import BlockingScheduler
from apscheduler.triggers.cron import CronTrigger
from datetime import datetime
@dramatiq.actor
def print_current_date():
print(datetime.now())
if __name__ == "__main__":
scheduler = BlockingScheduler()
scheduler.add_job(
print_current_date.send,
CronTrigger.from_crontab("* * * * *"),
)
try:
scheduler.start()
except KeyboardInterrupt:
scheduler.shutdown()
What did you expect would happen?
It should schedule a task.
What happened?
Some times it happens that scheduler fails on connection to rmq:
pika.adapters.utils.io_services_utils: _AsyncBaseTransport._produce() failed, aborting connection: error=ConnectionResetError(104, 'Connection reset by peer');
This is a known issue: https://github.com/Bogdanp/dramatiq/issues/217
And there is a known workaround: https://github.com/Bogdanp/dramatiq/issues/217#issuecomment-508347673
People could benefit if you update example with the workaround or at least mention the known problem and workaround in this example.