New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

celery beat schedule timezone and execute time #4177

Closed
nooperpudd opened this Issue Aug 2, 2017 · 18 comments

Comments

Projects
None yet
@nooperpudd

nooperpudd commented Aug 2, 2017

celery config,

software -> celery:4.1.0 (latentcall) kombu:4.1.0 py:3.5.2
            billiard:3.5.0.3 redis:2.10.5
platform -> system:Linux arch:64bit, ELF imp:CPython
loader   -> celery.loaders.app.AppLoader
settings -> transport:redis results:redis://127.0.0.1:6379/2

timezone: 'Asia/Shanghai'
enable_utc: True
accept_content: ['json']
result_expires: datetime.timedelta(0, 300)
result_serializer: 'json'
beat_schedule: {
    'stock.hello': {   'args': (),
                       'schedule': <crontab: 55 22 Mon,Tue,Wed,Thu,Fri * * (m/h/d/dM/MY)>,
                       'task': 'stock.hello'}}
imports: ['celery_tasks.stock.tasks', 'web.strategy.tasks']
result_backend: 'redis://127.0.0.1:6379/2'
task_serializer: 'json'
broker_url: 'redis://127.0.0.1:6379/1'

server local timezone: Asia/Beijing Timezone +08:00 CST

I want to start the celery beat schedule at 22:55:00 +08:00, but the tasks start at 2017-08-02 07:01:00 +8:00

@fanjindong

This comment has been minimized.

Show comment
Hide comment
@fanjindong

fanjindong Aug 7, 2017

+1 !!!

fanjindong commented Aug 7, 2017

+1 !!!

@neequole

This comment has been minimized.

Show comment
Hide comment
@neequole

neequole Aug 7, 2017

Can you check if this pull request fixes your problem? I also had the same problem running my scheduled job which was set to timezone 'Asia/Manila' and this fixes mine.

neequole commented Aug 7, 2017

Can you check if this pull request fixes your problem? I also had the same problem running my scheduled job which was set to timezone 'Asia/Manila' and this fixes mine.

@nooperpudd

This comment has been minimized.

Show comment
Hide comment
@nooperpudd

nooperpudd Aug 8, 2017

@neequole 4.1.0 version doesn't contain #4173 pull request. I will have a try.

nooperpudd commented Aug 8, 2017

@neequole 4.1.0 version doesn't contain #4173 pull request. I will have a try.

@neequole

This comment has been minimized.

Show comment
Hide comment
@neequole

neequole Aug 8, 2017

Yeah, I have to update it with the specific commit hash though.

neequole commented Aug 8, 2017

Yeah, I have to update it with the specific commit hash though.

@nooperpudd

This comment has been minimized.

Show comment
Hide comment
@nooperpudd

nooperpudd Aug 10, 2017

@neequole yes, I update the specific commit, it works.

#4173 pull request fix this problem.

nooperpudd commented Aug 10, 2017

@neequole yes, I update the specific commit, it works.

#4173 pull request fix this problem.

@dengshaochun

This comment has been minimized.

Show comment
Hide comment
@dengshaochun

dengshaochun commented Aug 15, 2017

+1

1 similar comment
@YukSeungChan

This comment has been minimized.

Show comment
Hide comment
@YukSeungChan

YukSeungChan commented Aug 31, 2017

+1

@timosir

This comment has been minimized.

Show comment
Hide comment
@timosir

timosir Oct 23, 2017

I have encountered the same problem, how to deal with?
CELERY_TIMEZONE = 'UTC'
CELERY_ENABLE_UTC = True
CELERY_TIMEZONE = 'Asia/Shanghai'
CELERYBEAT_SCHEDULE = {
'hq':{
'task':'operate.check_hangqing_sts',
'schedule': crontab(minute="38",hour='15')
}
}

when 38 minute ,its not run task ,how to deal with?

timosir commented Oct 23, 2017

I have encountered the same problem, how to deal with?
CELERY_TIMEZONE = 'UTC'
CELERY_ENABLE_UTC = True
CELERY_TIMEZONE = 'Asia/Shanghai'
CELERYBEAT_SCHEDULE = {
'hq':{
'task':'operate.check_hangqing_sts',
'schedule': crontab(minute="38",hour='15')
}
}

when 38 minute ,its not run task ,how to deal with?

@GGPPY

This comment has been minimized.

Show comment
Hide comment
@GGPPY

GGPPY Oct 26, 2017

i have the same problem too

GGPPY commented Oct 26, 2017

i have the same problem too

@timosir

This comment has been minimized.

Show comment
Hide comment
@timosir

timosir Oct 26, 2017

timosir commented Oct 26, 2017

@auvipy

This comment has been minimized.

Show comment
Hide comment
@auvipy

auvipy Dec 20, 2017

Member

I pr is open to address this issue please have a look and try that.

Member

auvipy commented Dec 20, 2017

I pr is open to address this issue please have a look and try that.

@axiaoxin

This comment has been minimized.

Show comment
Hide comment
@axiaoxin

axiaoxin Dec 26, 2017

+1
rollback to 4.0.2 fixed it

axiaoxin commented Dec 26, 2017

+1
rollback to 4.0.2 fixed it

@devintm

This comment has been minimized.

Show comment
Hide comment
@devintm

devintm Jan 2, 2018

+1....

Rolled back to 4.0.2 to fix it.

devintm commented Jan 2, 2018

+1....

Rolled back to 4.0.2 to fix it.

@auvipy

This comment has been minimized.

Show comment
Hide comment
@auvipy

auvipy Jan 15, 2018

Member

hope fully #4173 will fix the issue. wait for 4.2 release

Member

auvipy commented Jan 15, 2018

hope fully #4173 will fix the issue. wait for 4.2 release

@auvipy auvipy closed this Jan 15, 2018

@auvipy auvipy added this to the v4.2 milestone Jan 15, 2018

@Tur8008

This comment has been minimized.

Show comment
Hide comment
@Tur8008

Tur8008 Apr 13, 2018

Unfortunately, celery 4.1.0 is here but I have the same problem

Tur8008 commented Apr 13, 2018

Unfortunately, celery 4.1.0 is here but I have the same problem

@timfeirg

This comment has been minimized.

Show comment
Hide comment
@timfeirg

timfeirg Apr 14, 2018

I'm seeing this behavior using this setup:

$ celery --version
4.1.0 (latentcall)
$ timedatectl
      Local time: Sat 2018-04-14 12:30:49 CST
  Universal time: Sat 2018-04-14 04:30:49 UTC
        RTC time: Sat 2018-04-14 04:30:49
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: no
      DST active: n/a

With this celery config:

import os
from celery.schedules import crontab
from kombu import Queue


timezone = 'Asia/Shanghai'
enable_utc = True
broker_url = os.getenv('CELERY_BROKER_URL', 'redis://127.0.0.1:6379/1')
result_backend = os.getenv('CELERY_RESULT_BACKEND', 'redis://127.0.0.1:6379/1')
broker_transport_options = {'visibility_timeout': 10}
task_default_queue = 'miao'
task_queues = (
    Queue('miao', routing_key='miao'),
)
task_time_limit = 7200
task_default_exchange = 'miao'
task_default_routing_key = 'miao'
task_serializer = 'pickle'
accept_content = ['pickle', 'json']
beat_schedule = {
    'periodic-test': {
        'task': 'miao.tasks.periodic_test',
        'schedule': crontab(hour=12, minute='*'),
    },
}

consider re-open this issue? @auvipy

Also, rolling back celery to 4.0.2 doesn't fix the problem for me.

timfeirg commented Apr 14, 2018

I'm seeing this behavior using this setup:

$ celery --version
4.1.0 (latentcall)
$ timedatectl
      Local time: Sat 2018-04-14 12:30:49 CST
  Universal time: Sat 2018-04-14 04:30:49 UTC
        RTC time: Sat 2018-04-14 04:30:49
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: no
      DST active: n/a

With this celery config:

import os
from celery.schedules import crontab
from kombu import Queue


timezone = 'Asia/Shanghai'
enable_utc = True
broker_url = os.getenv('CELERY_BROKER_URL', 'redis://127.0.0.1:6379/1')
result_backend = os.getenv('CELERY_RESULT_BACKEND', 'redis://127.0.0.1:6379/1')
broker_transport_options = {'visibility_timeout': 10}
task_default_queue = 'miao'
task_queues = (
    Queue('miao', routing_key='miao'),
)
task_time_limit = 7200
task_default_exchange = 'miao'
task_default_routing_key = 'miao'
task_serializer = 'pickle'
accept_content = ['pickle', 'json']
beat_schedule = {
    'periodic-test': {
        'task': 'miao.tasks.periodic_test',
        'schedule': crontab(hour=12, minute='*'),
    },
}

consider re-open this issue? @auvipy

Also, rolling back celery to 4.0.2 doesn't fix the problem for me.

@Tur8008

This comment has been minimized.

Show comment
Hide comment
@Tur8008

Tur8008 Apr 14, 2018

Try to update to 4.2.0rc2

Tur8008 commented Apr 14, 2018

Try to update to 4.2.0rc2

@auvipy

This comment has been minimized.

Show comment
Hide comment
@auvipy

auvipy Apr 14, 2018

Member

have some sense, see this is tagged as 4.2

Member

auvipy commented Apr 14, 2018

have some sense, see this is tagged as 4.2

@celery celery locked as spam and limited conversation to collaborators Apr 14, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.