def worker(**options): "Run background worker instance." from django.conf import settings if settings.CELERY_ALWAYS_EAGER: raise click.ClickException( "Disable CELERY_ALWAYS_EAGER in your settings file to spawn workers." ) # These options are no longer used, but keeping around # for backwards compatibility for o in "without_gossip", "without_mingle", "without_heartbeat": options.pop(o, None) from sentry.celery import app with managed_bgtasks(role="worker"): worker = app.Worker( # NOTE: without_mingle breaks everything, # we can't get rid of this. Intentionally kept # here as a warning. Jobs will not process. # without_mingle=True, without_gossip=True, without_heartbeat=True, pool_cls="processes", **options) worker.start() try: sys.exit(worker.exitcode) except AttributeError: # `worker.exitcode` was added in a newer version of Celery: # https://github.com/celery/celery/commit/dc28e8a5 # so this is an attempt to be forwards compatible pass
def worker(**options): "Run background worker instance." from django.conf import settings if settings.CELERY_ALWAYS_EAGER: raise click.ClickException( "Disable CELERY_ALWAYS_EAGER in your settings file to spawn workers." ) from sentry.celery import app with managed_bgtasks(role="worker"): worker = app.Worker( # without_gossip=True, # without_mingle=True, # without_heartbeat=True, pool_cls="processes", **options ) worker.start() try: sys.exit(worker.exitcode) except AttributeError: # `worker.exitcode` was added in a newer version of Celery: # https://github.com/celery/celery/commit/dc28e8a5 # so this is an attempt to be forwards compatible pass