python - Celery beat - different time zone per task -


I'm using celery green to determine some functions. I am able to use the CELERY_TIMEZONE setting to schedule tasks using the Contrabab schedule and it runs at scheduled time in the scheduled time zone.

But I want to be able to set more than one such function in the same timezone (single django settings.py) in the same application. I know at what time the job must be run, when the task is being determined

Is it possible to specify a different time zone for each task?

I am using degena (1.4) with celery (3.0.11) and degengo cellari (3.0.11).

I have seen the djcelery.schedulers.DatabaseSudular class and this is the base class, but I can not understand how and how time is being used. Can I write a custom scheduler which can run each job in different timezones?

Thank you,

You have time-zone-aware time of individual tasks in a salary schedule -Certification can be achieved. By specifying different functions for each cellular schedule

This way you can adjust local time in a specific timezone (like adjusting daylight saving time too) Code> Crontab uses it to specify the datetime function, to check if it should run

  import datetime import pytz nowfun = lambda: datetime.datetime .now (pytz.timezone) ('Europe / Berlin'))   

In your schedule, Set the date as the time function through 'periodic_task': {'task': 'Api.tasks.asc.asks.periodic', 'schedule': crontab ( Hour = 6, minute = 30, nowfun = nowfun)}

It adjusts daily savings on daily 6.30am CET.

If you use the function more than once, import partial import from factum import cet_crontab = partial (crontab, nowfun = nowfun) 'periodic_task': consider making a helper

>

  {'Work': 'AP Cask. Make sure you have  CELERY_ENABLE_UTC = incorrect  set, otherwise the celestial ',' schedule ': cet_crontab (hours = 6, minute = 30)}   

Converts your schedule to UTC.

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -