Re: Management command scheduling options

2023-10-25 Thread Mike Dewhirst

On 25/10/2023 11:49 pm, Adam Stein wrote:

On Wed, 2023-10-25 at 08:24 -0400, Larry Martell wrote:
On Wed, Oct 25, 2023 at 5:35 AM Mike Dewhirst  
wrote:


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.


How are new servers deployed? How many new servers will be deployed?
If it's a one off thing you are doing manually, you just have to
remember to do it. If there are many, then you should use a tool like
terraform or octopus, or something similar and have that do it.



I use django-crontab myself for cron jobs. That way, I can add or 
update easily during deployment. Maybe you can make use of that so you 
can keep everything in your project.


This looks excellent, Adam. Thanks. I'll report back in due course.

Mike




--
Adam (a...@csh.rit.edu)

--
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6433ead4bf666e3ef52ac742df731e0cf7c66743.camel%40csh.rit.edu 
.



--
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/bc18ce9a-8ac8-41a6-adce-c36dbe9efee4%40dewhirst.com.au.


OpenPGP_signature.asc
Description: OpenPGP digital signature


Re: Management command scheduling options

2023-10-25 Thread Mike Dewhirst

On 25/10/2023 11:24 pm, Larry Martell wrote:

On Wed, Oct 25, 2023 at 5:35 AM Mike Dewhirst  wrote:

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.

How are new servers deployed? How many new servers will be deployed?
If it's a one off thing you are doing manually, you just have to
remember to do it.


It is a one-off but I'm assuming it will be someone else needing to do 
it rather than me.



  If there are many, then you should use a tool like
terraform or octopus, or something similar and have that do it.




--
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0a765bc2-ab30-4925-b43f-e31ae2c8b13b%40dewhirst.com.au.


OpenPGP_signature.asc
Description: OpenPGP digital signature


Re: Management command scheduling options

2023-10-25 Thread Adam Stein
On Wed, 2023-10-25 at 08:24 -0400, Larry Martell wrote:
> On Wed, Oct 25, 2023 at 5:35 AM Mike Dewhirst 
> wrote:
> > 
> > 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.
> 
> How are new servers deployed? How many new servers will be deployed?
> If it's a one off thing you are doing manually, you just have to
> remember to do it. If there are many, then you should use a tool like
> terraform or octopus, or something similar and have that do it.
> 

I use django-crontab myself for cron jobs. That way, I can add or
update easily during deployment. Maybe you can make use of that so you
can keep everything in your project.

-- 
Adam (a...@csh.rit.edu)

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6433ead4bf666e3ef52ac742df731e0cf7c66743.camel%40csh.rit.edu.


Re: Management command scheduling options

2023-10-25 Thread Larry Martell
On Wed, Oct 25, 2023 at 5:35 AM Mike Dewhirst  wrote:
>
> 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.

How are new servers deployed? How many new servers will be deployed?
If it's a one off thing you are doing manually, you just have to
remember to do it. If there are many, then you should use a tool like
terraform or octopus, or something similar and have that do it.

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACwCsY5xFsBK7Joe4U6-itLv7%2BSrMQ0OyQ1VJ%3DscFvTmepsPbw%40mail.gmail.com.


Re: Management command scheduling options

2023-10-25 Thread Mike Dewhirst
AhmedrufaiI 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.CheersMike--(Unsigned mail from my phone)
 Original message From: Ahmedrufai Otuoze 
 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 
 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+unsubscr...@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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAA50JbfV1VXkpeoXLEcsOp2j0WeXM5dfKH9BbQKLAeipnOhvsQ%40mail.gmail.com.

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6538e144.170a0220.b001a.862aSMTPIN_ADDED_MISSING%40gmr-mx.google.com.


Re: Management command scheduling options

2023-10-23 Thread Mike Dewhirst

On 23/10/2023 11:48 pm, Rodrigo Bistolfi wrote:

Use devops for setting up cron jobs as part of the deployment process.


My requirement is very lightweight and cron would definitely work for 
me. Both Celery and APScheduler seem like overkill.


How would you ensure the cron job was established on a new server?

Mike

You could also use something like 
https://apscheduler.readthedocs.io/en/3.x/ if you wanna something OS 
independent.


El lun, 23 oct 2023 a las 7:08, Mike Dewhirst 
() escribió:


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+unsubscr...@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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMQZ-Rf5sRxEZNEoGxHjh6f88FGsWHgTqCp%2BbUY4%2BH4GX3_7Kg%40mail.gmail.com 
.



--
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8feecef1-d78b-4db1-a01f-15c08d7035c2%40dewhirst.com.au.


OpenPGP_signature.asc
Description: OpenPGP digital signature


Re: Management command scheduling options

2023-10-23 Thread Ahmedrufai Otuoze
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  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+unsubscr...@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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAA50JbfV1VXkpeoXLEcsOp2j0WeXM5dfKH9BbQKLAeipnOhvsQ%40mail.gmail.com.


Re: Management command scheduling options

2023-10-23 Thread Rodrigo Bistolfi
Use devops for setting up cron jobs as part of the deployment process. You
could also use something like https://apscheduler.readthedocs.io/en/3.x/ if
you wanna something OS independent.

El lun, 23 oct 2023 a las 7:08, Mike Dewhirst ()
escribió:

> 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+unsubscr...@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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMQZ-Rf5sRxEZNEoGxHjh6f88FGsWHgTqCp%2BbUY4%2BH4GX3_7Kg%40mail.gmail.com.


Re: Management command scheduling options

2023-10-23 Thread Alessandro Madruga Correia
Django-celery


Em seg., 23 de out. de 2023 às 07:08, Mike Dewhirst 
escreveu:

> 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+unsubscr...@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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOofabeYp%2B3kTHm4k5mQRL-jpHtgqtJADqUYPyAi%2BbjW3fh67g%40mail.gmail.com.


Management command scheduling options

2023-10-23 Thread Mike Dewhirst
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+unsubscr...@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.


OpenPGP_signature.asc
Description: OpenPGP digital signature