Wednesday, October 25, 2023

Re: Management command scheduling options

Ahmedrufai

I looked at APScheduler and like Celery it is too much of a sledgehammer for my tiny problem. 

I ended up using cron to launch the command each day. It works perfectly.

My task now is to find a way to automate establishment of that crontab entry when the project is migrated to a new server.

Cheers

Mike




--
(Unsigned mail from my phone)



-------- Original message --------
From: Ahmedrufai Otuoze <otuozeahmedrufai@gmail.com>
Date: 24/10/23 00:11 (GMT+10:00)
To: django-users@googlegroups.com
Subject: Re: Management command scheduling options

Hi Mike,

I've implemented something similar to what you mentioned lately. I used this Python package called APScheduler to schedule and run database intensive queries behind the scene and then cache the result for my users to fetch from making their experience super fast.

The APScheduler can be configured to run at any interval daily, weekly, monthly or any customized interval you require. It's a game changer and a quick win for Windows based OS as they don't support the use of Celery or any other Linux based schedulers without WSL.

Do let me know if you're interested in my implementation, I'm open to show you.

Regards 

On Mon, Oct 23, 2023, 11:09 AM Mike Dewhirst <miked@dewhirst.com.au> wrote:
Django docs suggest cron or Windows scheduler for running management commands.

I would like instead to build an internal Django based scheduler - because after migrating to a new server, setting up the new cron task will be forgotten.

Is there a daily (approximately) event in a Django project I can hook into and test the date?

The task is somewhat database intensive and needs to run quarterly for some users, monthly for most and weekly for others depending on their preferences.

Ideas anyone?

Thanks

Mike

--   Signed email is an absolute defence against phishing. This email has  been signed with my private key. If you import my public key you can  automatically decrypt my signature and be sure it came from me. Your  email software can handle signing.  

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7b29b24b-64f0-4f93-9a43-5d8f5e242b57%40dewhirst.com.au.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAA50JbfV1VXkpeoXLEcsOp2j0WeXM5dfKH9BbQKLAeipnOhvsQ%40mail.gmail.com.

No comments:

Post a Comment