Created
February 22, 2018 10:42
-
-
Save jbub/34857c2ae8c48b5be5f99097b94680aa to your computer and use it in GitHub Desktop.
This file contains hidden or 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 celery.utils.log import get_task_logger | |
logger = get_task_logger(__name__) | |
app = Celery('cel') | |
app.config_from_object('celeryconfig') | |
@app.task | |
def runCli(site, namespace, module, console, command, host=None): | |
logger.info('site={0} namespace={1} module={2} console={3} command={4} host={5}'.format(site, namespace, module, console, command, host)) | |
return 123 |
This file contains hidden or 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 kombu import Queue | |
broker_url = 'redis://localhost:6379/4' | |
result_backend = 'redis://localhost:6379/5' | |
task_serializer = 'json' | |
result_serializer = 'json' | |
task_routes = { | |
'cel.runCli': { | |
'queue': 'cel', | |
'routing_key': 'cel', | |
}, | |
} | |
worker_log_format = '[%(asctime)s] %(message)s' | |
worker_task_log_format = '[%(asctime)s] [%(task_name)s] %(message)s' |
This file contains hidden or 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 cel import runCli | |
kwargs = { | |
'site': 123, | |
'namespace': 432, | |
'module': 423, | |
'console': 4324, | |
'command': 1231, | |
'host': None, | |
} | |
runCli.apply_async(kwargs=kwargs) |
This file contains hidden or 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 cel worker -n cel@%h -E -l info --concurrency=1 -Q cel -f /var/log/blabla/%n-%i.log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment