def main(): """Celery process entry point. Wrap celery command line script with our INI reader. .. note :: Make sure there is no global app = Celery() in any point of your code base, or this doesn't work. """ global ini_file global request if len(sys.argv) < 2: sys.exit("Example usage: ws-celery myapp/conf/development.ini -- worker") ini_file = sys.argv[1] if not ini_file.endswith(".ini"): sys.exit("The first argument must be a configuration file") if len(sys.argv) >= 3: if not sys.argv[2] == "--": raise RuntimeError("The second argument must be -- to signal command line argument passthrough") celery_args = sys.argv[3:] else: celery_args = [] # https://github.com/celery/celery/issues/3405 os.environ["CELERY_LOADER"] = "websauna.system.task.celeryloader.WebsaunaLoader" argv = ["celery"] + celery_args # Directly jump to Celery 4.0+ entry point from celery.bin.celery import main main(argv)
def main(argv: t.List[str]=sys.argv): """Celery process entry point. Wrap celery command line script with our INI reader. .. note :: Make sure there is no global app = Celery() in any point of your code base, or this doesn't work. """ global ini_file global request if len(argv) < 2: usage_message(argv) ini_file = get_config_uri(argv) if not ini_file.endswith(".ini"): sys.exit("The first argument must be a configuration file") if len(argv) >= 3: if not argv[2] == "--": raise RuntimeError("The second argument must be -- to signal command line argument passthrough") celery_args = sys.argv[3:] else: celery_args = [] # https://github.com/celery/celery/issues/3405 os.environ["CELERY_LOADER"] = "websauna.system.task.celeryloader.WebsaunaLoader" argv = ["celery"] + celery_args # Directly jump to Celery 4.0+ entry point from celery.bin.celery import main main(argv)
def run_celery(argv=sys.argv): initialise() os.environ['CELERYD_REDIRECT_STDOUTS'] = 'False' # technically we don't need this, as we disable celery's logging # altogether, but it doesn't hurt os.environ['CELERYD_HIJACK_ROOT_LOGGER'] = 'False' ensure_extra_versions_supported('celery') import talisker.celery from celery.bin.celery import main talisker.celery.enable_signals() main(argv)
def run_celery(argv=sys.argv): initialise() os.environ['CELERYD_REDIRECT_STDOUTS'] = 'False' # technically we don't need this, as we disable celery's logging # altogether, but it doesn't hurt os.environ['CELERYD_HIJACK_ROOT_LOGGER'] = 'False' ensure_extra_versions_supported('celery') import talisker.celery from celery.bin.celery import main talisker.celery.enable_signals() clear_contexts() main(argv)
def run_beat(args): os.environ.setdefault("ROLE", 'beat') from celery.bin.celery import main return main(sys.argv[:1] + [ '-A', 'hemail', 'beat', '--scheduler', 'django_celery_beat.schedulers:DatabaseScheduler', ] + args)
def run_worker(): """Starts a celery worker which will """ from flask import current_app print("config", current_app.config) main( [ "", "-A", "taiga2.celery:app", "worker", "-l", "info", "-E", "-n", "worker1@%h", "--max-memory-per-child", "200000", ] )
def _compat_beat(): maybe_patch_concurrency() _warn_deprecated('celery beat') from celery.bin.beat import main main()
def _compat_multi(): _warn_deprecated('celery multi') from celery.bin.multi import main main()
from __future__ import absolute_import, print_function, unicode_literals import sys from . import maybe_patch_concurrency __all__ = ['main'] def main(): if 'multi' not in sys.argv: maybe_patch_concurrency() from celery.bin.celery import main main() if __name__ == '__main__': # pragma: no cover main()
def _compat_multi(): maybe_patch_concurrency() maybe_patch_kill() _warn_deprecated('celery multi') from celery.bin.multi import main main()
def _compat_beat(): maybe_patch_concurrency() from celery.bin.celerybeat import main main()
def test_main(self, Command): command = Command.return_value = Mock() main() command.execute_from_commandline.assert_called_with()
def main(): if 'multi' not in sys.argv: maybe_patch_concurrency() from celery.bin.celery import main main()
def run_celery(args): os.environ.setdefault("ROLE", 'celery') from celery.bin.celery import main return main(sys.argv[:1] + ['-A', 'hemail', 'worker'] + args)
def handle(self, options, global_options, *args): from celery.bin import celery self.get_application(global_options) args = list(args) args.insert(0, 'celery') celery.main(args)
from celery.bin.celery import main main( [ 'main', '-A', 'staging.celery.manager', 'worker', '--concurrency', '1' ] )
def _compat_worker(): maybe_patch_concurrency() from celery.bin.celeryd import main main()
def test_main(self, Command): command = Command.return_value = Mock() main() command.execute_from_commandline.assert_called_with(None)
def main(): maybe_patch_concurrency() maybe_patch_kill() from celery.bin.celery import main main()
def handle(self, *args, **options): argv = ["--app=mds_website", "worker", "-l", "info"] celery.main(argv)
def _compat_multi(): maybe_patch_concurrency() from celery.bin.celeryd_multi import main main()
def main(): maybe_patch_concurrency() from celery.bin.celery import main main()
from celery.bin.celery import main main() def _compat_worker(): maybe_patch_concurrency() maybe_patch_kill() _warn_deprecated('celery worker') from celery.bin.worker import main main() def _compat_multi(): maybe_patch_concurrency() maybe_patch_kill() _warn_deprecated('celery multi') from celery.bin.multi import main main() def _compat_beat(): maybe_patch_concurrency() maybe_patch_kill() _warn_deprecated('celery beat') from celery.bin.beat import main main() if __name__ == '__main__': main()
def _compat_multi(): maybe_patch_concurrency() _warn_deprecated('celery multi') from celery.bin.multi import main main()
def _compat_worker(): maybe_patch_concurrency() maybe_patch_kill() _warn_deprecated('celery worker') from celery.bin.worker import main main()
def run_from_argv(self, argv): from celery.bin.celery import main main(self.get_argv(argv))
def _compat_beat(): maybe_patch_concurrency() maybe_patch_kill() _warn_deprecated('celery beat') from celery.bin.beat import main main()
def _compat_worker(): maybe_patch_concurrency() _warn_deprecated('celery worker') from celery.bin.worker import main main()
from celery.bin import celery if __name__ == '__main__': celery.main()