Last active
October 20, 2017 18:15
-
-
Save shane0/fe304d696ab2bf4d4e3a6ef0b9609f89 to your computer and use it in GitHub Desktop.
celery beat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
celery -A beat beat -l debug |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from celery import Celery | |
from web_tasks import Web | |
celery = Celery() | |
celery.config_from_object() | |
@celery.task | |
def web_task(site): | |
print('running a web task') | |
Web.open_url(site) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from celery.schedules import crontab | |
# using rabbitmq | |
broker_url = 'amqp://user:user@localhost:5672//' | |
result_backend = 'amqp://user:user@localhost:5672//' | |
beat_schedule = { | |
'every-minute': { | |
'task': 'worker.web_task', | |
'schedule': crontab(minute='*/1'), | |
'args': ['http://google.com'], | |
}, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
flower -A worker --port=5555 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
celery | |
flower |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import webbrowser | |
class Web: | |
def __init__(self, url): | |
self.url = url | |
def open_url(url): | |
webbrowser.open(url) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
celery -A worker worker -l info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from celery import Celery | |
from web_tasks import Web | |
celery = Celery() | |
celery.config_from_object('celeryconfig') | |
@celery.task | |
def web_task(site): | |
print('running a web task') | |
Web.open_url(site) |
For a different project I've had to pin to github because the latest version on pypi are buggy for the features I need to use (solar schedules) so I wouldn't rule out issues with the version you were on.
thanks for the tips I'll try that
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
celery ~= 3.1.18