##// END OF EJS Templates
celery: introduce make_app instead of creating app at import time...
Mads Kiilerich -
r8042:19313892 default
parent child Browse files
Show More
@@ -16,6 +16,7 b' import click'
16
16
17 import kallithea
17 import kallithea
18 import kallithea.bin.kallithea_cli_base as cli_base
18 import kallithea.bin.kallithea_cli_base as cli_base
19 from kallithea.lib import celerypylons
19
20
20
21
21 @cli_base.register_command(config_file_initialize_app=True)
22 @cli_base.register_command(config_file_initialize_app=True)
@@ -35,6 +36,6 b' def celery_run(celery_args):'
35 raise Exception('Please set use_celery = true in .ini config '
36 raise Exception('Please set use_celery = true in .ini config '
36 'file before running this command')
37 'file before running this command')
37
38
38 from kallithea.lib import celerypylons
39 app = celerypylons.make_app()
39 cmd = celerypylons.worker.worker(celerypylons.app)
40 cmd = celerypylons.worker.worker(app)
40 return cmd.run_from_argv(None, command='celery-run -c CONFIG_FILE --', argv=list(celery_args))
41 return cmd.run_from_argv(None, command='celery-run -c CONFIG_FILE --', argv=list(celery_args))
@@ -53,6 +53,8 b' def celery_config(config):'
53 return celery_config
53 return celery_config
54
54
55
55
56 # Create celery app from the TurboGears configuration file
56 def make_app():
57 app = celery.Celery()
57 """Create celery app from the TurboGears configuration file"""
58 app.config_from_object(celery_config(tg.config))
58 app = celery.Celery()
59 app.config_from_object(celery_config(tg.config))
60 return app
General Comments 0
You need to be logged in to leave comments. Login now