New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

celery report: Apps aren't loaded yet #4731

Closed
jonashaag opened this Issue May 14, 2018 · 6 comments

Comments

Projects
None yet
4 participants
@jonashaag
Contributor

jonashaag commented May 14, 2018

Report is broken in celery >= 4.1 (other versions untested).

rc2

Traceback (most recent call last):
  File "/tmp/venv/bin/celery", line 11, in <module>
    sys.exit(main())
  File "/tmp/venv/lib/python3.6/site-packages/celery/__main__.py", line 16, in main
    _main()
  File "/tmp/venv/lib/python3.6/site-packages/celery/bin/celery.py", line 322, in main
    cmd.execute_from_commandline(argv)
  File "/tmp/venv/lib/python3.6/site-packages/celery/bin/celery.py", line 484, in execute_from_commandline
    super(CeleryCommand, self).execute_from_commandline(argv)))
  File "/tmp/venv/lib/python3.6/site-packages/celery/bin/base.py", line 275, in execute_from_commandline
    return self.handle_argv(self.prog_name, argv[1:])
  File "/tmp/venv/lib/python3.6/site-packages/celery/bin/celery.py", line 476, in handle_argv
    return self.execute(command, argv)
  File "/tmp/venv/lib/python3.6/site-packages/celery/bin/celery.py", line 408, in execute
    ).run_from_argv(self.prog_name, argv[1:], command=argv[0])
  File "/tmp/venv/lib/python3.6/site-packages/celery/bin/base.py", line 279, in run_from_argv
    sys.argv if argv is None else argv, command)
  File "/tmp/venv/lib/python3.6/site-packages/celery/bin/base.py", line 363, in handle_argv
    return self(*args, **options)
  File "/tmp/venv/lib/python3.6/site-packages/celery/bin/base.py", line 238, in __call__
    ret = self.run(*args, **kwargs)
  File "/tmp/venv/lib/python3.6/site-packages/celery/bin/celery.py", line 359, in run
    self.out(self.app.bugreport())
  File "/tmp/venv/lib/python3.6/site-packages/celery/app/base.py", line 901, in bugreport
    return bugreport(self)
  File "/tmp/venv/lib/python3.6/site-packages/celery/app/utils.py", line 349, in bugreport
    human_settings=app.conf.humanize(),
  File "/tmp/venv/lib/python3.6/site-packages/celery/app/utils.py", line 193, in humanize
    for key, value in items(self.table(with_defaults, censored)))
  File "/tmp/venv/lib/python3.6/site-packages/celery/app/utils.py", line 193, in <genexpr>
    for key, value in items(self.table(with_defaults, censored)))
  File "/tmp/venv/lib/python3.6/site-packages/celery/utils/text.py", line 124, in pretty
    return pformat(value, width=width, **kw)
  File "/usr/lib/python3.6/pprint.py", line 58, in pformat
    compact=compact).pformat(object)
  File "/usr/lib/python3.6/pprint.py", line 144, in pformat
    self._format(object, sio, 0, 0, {}, 0)
  File "/usr/lib/python3.6/pprint.py", line 161, in _format
    rep = self._repr(object, context, level)
  File "/usr/lib/python3.6/pprint.py", line 393, in _repr
    self._depth, level)
  File "/usr/lib/python3.6/pprint.py", line 405, in format
    return _safe_repr(object, context, maxlevels, level)
  File "/usr/lib/python3.6/pprint.py", line 555, in _safe_repr
    rep = repr(object)
  File "/tmp/venv/lib/python3.6/site-packages/django/utils/functional.py", line 79, in __repr__
    return repr(self.__cast())
  File "/tmp/venv/lib/python3.6/site-packages/django/utils/functional.py", line 131, in __cast
    return self.__text_cast()
  File "/tmp/venv/lib/python3.6/site-packages/django/utils/functional.py", line 119, in __text_cast
    return func(*self.__args, **self.__kw)
  File "/tmp/venv/lib/python3.6/site-packages/django/urls/base.py", line 91, in reverse
    return force_text(iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs)))
  File "/tmp/venv/lib/python3.6/site-packages/django/urls/resolvers.py", line 436, in _reverse_with_prefix
    self._populate()
  File "/tmp/venv/lib/python3.6/site-packages/django/urls/resolvers.py", line 288, in _populate
    for pattern in reversed(self.url_patterns):
  File "/tmp/venv/lib/python3.6/site-packages/django/utils/functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/tmp/venv/lib/python3.6/site-packages/django/urls/resolvers.py", line 405, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/tmp/venv/lib/python3.6/site-packages/django/utils/functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/tmp/venv/lib/python3.6/site-packages/django/urls/resolvers.py", line 398, in urlconf_module
    return import_module(self.urlconf_name)
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/XXX/urls.py", line 16, in <module>
    import allauth.account.views
  File "/tmp/venv/lib/python3.6/site-packages/allauth/account/views.py", line 19, in <module>
    from .adapter import get_adapter
  File "/tmp/venv/lib/python3.6/site-packages/allauth/account/adapter.py", line 16, in <module>
    from django.contrib.auth.models import AbstractUser
  File "/tmp/venv/lib/python3.6/site-packages/django/contrib/auth/models.py", line 4, in <module>
    from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
  File "/tmp/venv/lib/python3.6/site-packages/django/contrib/auth/base_user.py", line 52, in <module>
    class AbstractBaseUser(models.Model):
  File "/tmp/venv/lib/python3.6/site-packages/django/db/models/base.py", line 110, in __new__
    app_config = apps.get_containing_app_config(module)
  File "/tmp/venv/lib/python3.6/site-packages/django/apps/registry.py", line 247, in get_containing_app_config
    self.check_apps_ready()
  File "/tmp/venv/lib/python3.6/site-packages/django/apps/registry.py", line 125, in check_apps_ready
    raise AppRegistryNotReady("Apps aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.

rc3

Traceback (most recent call last):
  File "/tmp/venv/bin/celery", line 11, in <module>
    sys.exit(main())
  File "/tmp/venv/lib/python3.6/site-packages/celery/__main__.py", line 16, in main
    _main()
  File "/tmp/venv/lib/python3.6/site-packages/celery/bin/celery.py", line 322, in main
    cmd.execute_from_commandline(argv)
  File "/tmp/venv/lib/python3.6/site-packages/celery/bin/celery.py", line 484, in execute_from_commandline
    super(CeleryCommand, self).execute_from_commandline(argv)))
  File "/tmp/venv/lib/python3.6/site-packages/celery/bin/base.py", line 275, in execute_from_commandline
    return self.handle_argv(self.prog_name, argv[1:])
  File "/tmp/venv/lib/python3.6/site-packages/celery/bin/celery.py", line 476, in handle_argv
    return self.execute(command, argv)
  File "/tmp/venv/lib/python3.6/site-packages/celery/bin/celery.py", line 408, in execute
    ).run_from_argv(self.prog_name, argv[1:], command=argv[0])
  File "/tmp/venv/lib/python3.6/site-packages/celery/bin/base.py", line 279, in run_from_argv
    sys.argv if argv is None else argv, command)
  File "/tmp/venv/lib/python3.6/site-packages/celery/bin/base.py", line 363, in handle_argv
    return self(*args, **options)
  File "/tmp/venv/lib/python3.6/site-packages/celery/bin/base.py", line 238, in __call__
    ret = self.run(*args, **kwargs)
  File "/tmp/venv/lib/python3.6/site-packages/celery/bin/celery.py", line 359, in run
    self.out(self.app.bugreport())
  File "/tmp/venv/lib/python3.6/site-packages/celery/app/base.py", line 900, in bugreport
    return bugreport(self)
  File "/tmp/venv/lib/python3.6/site-packages/celery/app/utils.py", line 349, in bugreport
    human_settings=app.conf.humanize(),
  File "/tmp/venv/lib/python3.6/site-packages/celery/app/utils.py", line 193, in humanize
    for key, value in items(self.table(with_defaults, censored)))
  File "/tmp/venv/lib/python3.6/site-packages/celery/app/utils.py", line 193, in <genexpr>
    for key, value in items(self.table(with_defaults, censored)))
  File "/tmp/venv/lib/python3.6/site-packages/celery/utils/text.py", line 124, in pretty
    return pformat(value, width=width, **kw)
  File "/usr/lib/python3.6/pprint.py", line 58, in pformat
    compact=compact).pformat(object)
  File "/usr/lib/python3.6/pprint.py", line 144, in pformat
    self._format(object, sio, 0, 0, {}, 0)
  File "/usr/lib/python3.6/pprint.py", line 161, in _format
    rep = self._repr(object, context, level)
  File "/usr/lib/python3.6/pprint.py", line 393, in _repr
    self._depth, level)
  File "/usr/lib/python3.6/pprint.py", line 405, in format
    return _safe_repr(object, context, maxlevels, level)
  File "/usr/lib/python3.6/pprint.py", line 555, in _safe_repr
    rep = repr(object)
  File "/tmp/venv/lib/python3.6/site-packages/django/utils/functional.py", line 79, in __repr__
    return repr(self.__cast())
  File "/tmp/venv/lib/python3.6/site-packages/django/utils/functional.py", line 131, in __cast
    return self.__text_cast()
  File "/tmp/venv/lib/python3.6/site-packages/django/utils/functional.py", line 119, in __text_cast
    return func(*self.__args, **self.__kw)
  File "/tmp/venv/lib/python3.6/site-packages/django/urls/base.py", line 91, in reverse
    return force_text(iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs)))
  File "/tmp/venv/lib/python3.6/site-packages/django/urls/resolvers.py", line 436, in _reverse_with_prefix
    self._populate()
  File "/tmp/venv/lib/python3.6/site-packages/django/urls/resolvers.py", line 288, in _populate
    for pattern in reversed(self.url_patterns):
  File "/tmp/venv/lib/python3.6/site-packages/django/utils/functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/tmp/venv/lib/python3.6/site-packages/django/urls/resolvers.py", line 405, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/tmp/venv/lib/python3.6/site-packages/django/utils/functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/tmp/venv/lib/python3.6/site-packages/django/urls/resolvers.py", line 398, in urlconf_module
    return import_module(self.urlconf_name)
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/XXX/urls.py", line 16, in <module>
    import allauth.account.views
  File "/tmp/venv/lib/python3.6/site-packages/allauth/account/views.py", line 19, in <module>
    from .adapter import get_adapter
  File "/tmp/venv/lib/python3.6/site-packages/allauth/account/adapter.py", line 16, in <module>
    from django.contrib.auth.models import AbstractUser
  File "/tmp/venv/lib/python3.6/site-packages/django/contrib/auth/models.py", line 4, in <module>
    from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
  File "/tmp/venv/lib/python3.6/site-packages/django/contrib/auth/base_user.py", line 52, in <module>
    class AbstractBaseUser(models.Model):
  File "/tmp/venv/lib/python3.6/site-packages/django/db/models/base.py", line 110, in __new__
    app_config = apps.get_containing_app_config(module)
  File "/tmp/venv/lib/python3.6/site-packages/django/apps/registry.py", line 247, in get_containing_app_config
    self.check_apps_ready()
  File "/tmp/venv/lib/python3.6/site-packages/django/apps/registry.py", line 125, in check_apps_ready
    raise AppRegistryNotReady("Apps aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.

Refs #4713

@jonashaag

This comment has been minimized.

Contributor

jonashaag commented May 14, 2018

You should be able to reproduce the crash with the test project from #4713

@xirdneh

This comment has been minimized.

Member

xirdneh commented May 15, 2018

@jonashaag Which version of Django?

@jonashaag

This comment has been minimized.

Contributor

jonashaag commented May 15, 2018

1.11

@xirdneh xirdneh self-assigned this May 18, 2018

This was referenced May 24, 2018

@auvipy

This comment has been minimized.

Member

auvipy commented May 24, 2018

@jonashaag could you check @xirdneh patch too?

@jonashaag

This comment has been minimized.

Contributor

jonashaag commented May 25, 2018

Can confirm that @xirdneh's patch fixes the issue!

@auvipy

This comment has been minimized.

Member

auvipy commented May 25, 2018

thank you

thedrow added a commit that referenced this issue May 27, 2018

Fixes issue #4731 (#4762)
* Import default modules when running a report to avoid issues: issue/4731

* Updating CONTRIBUTORS.txt

* Add report command test to check import_default_modules call

@thedrow thedrow closed this May 27, 2018

dfresh613 added a commit to dfresh613/celery that referenced this issue Jul 21, 2018

Fixes issue celery#4731 (celery#4762)
* Import default modules when running a report to avoid issues: issue/4731

* Updating CONTRIBUTORS.txt

* Add report command test to check import_default_modules call

dfresh613 added a commit to dfresh613/celery that referenced this issue Jul 21, 2018

Fixes issue celery#4731 (celery#4762)
* Import default modules when running a report to avoid issues: issue/4731

* Updating CONTRIBUTORS.txt

* Add report command test to check import_default_modules call
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment