{"action":"created","issue":{"url":"https://api.github.com/repos/celery/celery/issues/3048","repository_url":"https://api.github.com/repos/celery/celery","labels_url":"https://api.github.com/repos/celery/celery/issues/3048/labels{/name}","comments_url":"https://api.github.com/repos/celery/celery/issues/3048/comments","events_url":"https://api.github.com/repos/celery/celery/issues/3048/events","html_url":"https://github.com/celery/celery/issues/3048","id":133037265,"number":3048,"title":"Celery task fails because of custom Django user model","user":{"login":"kviktor","id":1112058,"avatar_url":"https://avatars.githubusercontent.com/u/1112058?v=3","gravatar_id":"","url":"https://api.github.com/users/kviktor","html_url":"https://github.com/kviktor","followers_url":"https://api.github.com/users/kviktor/followers","following_url":"https://api.github.com/users/kviktor/following{/other_user}","gists_url":"https://api.github.com/users/kviktor/gists{/gist_id}","starred_url":"https://api.github.com/users/kviktor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kviktor/subscriptions","organizations_url":"https://api.github.com/users/kviktor/orgs","repos_url":"https://api.github.com/users/kviktor/repos","events_url":"https://api.github.com/users/kviktor/events{/privacy}","received_events_url":"https://api.github.com/users/kviktor/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/celery/celery/labels/Component:%20Django","name":"Component: Django","color":"ededed"},{"url":"https://api.github.com/repos/celery/celery/labels/Status:%20Needs%20Verification","name":"Status: Needs Verification","color":"0052cc"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-02-11T17:37:32Z","updated_at":"2016-06-30T08:40:58Z","closed_at":"2016-06-30T08:40:58Z","body":"Whenever I call a task on its queue I get this error. The WARNING/PoolWorker-1 message is `print(settings.INSTALLED_APPS)` (so the profile app is in INSTALLED apps, I don't know why celery can't find it). I'm using the current Celery master. (somewhat related issue #3041)\r\n\r\n```\r\n -------------- celery@hostname v4.0.0rc1 (0today8)\r\n---- **** -----\r\n--- * ***  * -- Linux-3.13.0-48-generic-x86_64-with-Ubuntu-14.04-trusty 2016-02-10 14:52:07\r\n-- * - **** ---\r\n- ** ---------- [config]\r\n- ** ---------- .> app:         manager:0x7fedb4977278\r\n- ** ---------- .> transport:   amqp://user:**@127.0.0.1:5672/project\r\n- ** ---------- .> results:     amqp\r\n- *** --- * --- .> concurrency: 1 (prefork)\r\n-- ******* ----\r\n--- ***** ----- [queues]\r\n -------------- .> manager          exchange=manager(direct) key=manager\r\n               \r\n \r\n[tasks]\r\n  . belam\r\n  . execcelery.gcc_compile\r\n  . execcelery.run_program\r\n  . execcelery.run_script\r\n \r\n[2016-02-10 14:52:08,026: INFO/MainProcess] Connected to amqp://user:**@127.0.0.1:5672/project\r\n[2016-02-10 14:52:08,041: INFO/MainProcess] mingle: searching for neighbors\r\n[2016-02-10 14:52:09,067: INFO/MainProcess] mingle: sync with 1 nodes\r\n[2016-02-10 14:52:09,068: INFO/MainProcess] mingle: sync complete\r\ncelery/fixups/django.py:300: UserWarning: Using s\r\nettings.DEBUG leads to a memory leak, never use this setting in production environments!\r\n  warnings.warn('Using settings.DEBUG leads to a memory leak, never '\r\n \r\n[2016-02-10 14:52:09,082: WARNING/MainProcess] ce\r\nlery/fixups/django.py:300: UserWarning: Using settings.DEBUG leads to a memory leak, never use this settin\r\ng in production environments!\r\n  warnings.warn('Using settings.DEBUG leads to a memory leak, never '\r\n \r\n[2016-02-10 14:52:09,084: WARNING/MainProcess] celery@hostname ready.\r\n0[2016-02-10 14:52:53,147: INFO/MainProcess] Received task: belam[f230b09e-34c2-4d14-a365-16ff8cc3e591]  \r\n[2016-02-10 14:52:53,753: WARNING/PoolWorker-1] ('django.contrib.auth', 'django.contrib.contenttypes', 'dj\r\nango.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', '\r\ndjango.contrib.admin', 'django_tables2', 'crispy_forms', 'taggit', 'acl', 'widget_tweaks', 'sizefield', 'a\r\nutocomplete_light', 'profile', 'course', 'lecture', 'grading', 'exercise', 'assignment', 'dashboard', 'man\r\nagement', 'rosetta')\r\n[2016-02-10 14:52:53,801: ERROR/PoolWorker-1] Task belam[f230b09e-34c2-4d14-a365-16ff8cc3e591] raised unex\r\npected: ValueError(\"Related model 'profile.ProjectUser' cannot be resolved\",)\r\nTraceback (most recent call last):\r\n  File \"celery/app/trace.py\", line 358, in trace_\r\ntask\r\n    R = retval = fun(*args, **kwargs)\r\n  File \"celery/app/trace.py\", line 609, in __prot\r\nected_call__\r\n    return self.run(*args, **kwargs)\r\n  File \"project/project/exercise/tasks.py\", line 9, in evaluate_submission\r\n    Submission.objects.get(pk=submission_pk).evaluate()\r\n  File \"django/db/models/manager.py\", line 127, in manager_method\r\n    return getattr(self.get_queryset(), name)(*args, **kwargs)\r\n  File \"django/db/models/query.py\", line 328, in\r\nget\r\n    num = len(clone)\r\n  File \"django/db/models/query.py\", line 144, in\r\n__len__\r\n    self._fetch_all()\r\n  File \"django/db/models/query.py\", line 965, in\r\n_fetch_all\r\n    self._result_cache = list(self.iterator())\r\n  File \"django/db/models/query.py\", line 238, in\r\niterator\r\n    results = compiler.execute_sql()\r\n  File \"django/db/models/sql/compiler.py\", line 8\r\n29, in execute_sql\r\n    sql, params = self.as_sql()\r\n  File \"django/db/models/sql/compiler.py\", line 3\r\n78, in as_sql\r\n    extra_select, order_by, group_by = self.pre_sql_setup()\r\n  File \"django/db/models/sql/compiler.py\", line 4\r\n8, in pre_sql_setup\r\n    self.setup_query()\r\n  File \"django/db/models/sql/compiler.py\", line 3\r\n9, in setup_query\r\n    self.select, self.klass_info, self.annotation_col_map = self.get_select()\r\n  File \"django/db/models/sql/compiler.py\", line 1\r\n87, in get_select\r\n    for c in self.get_default_columns():\r\n  File \"django/db/models/sql/compiler.py\", line 5\r\n24, in get_default_columns\r\n    column = field.get_col(alias)\r\n  File \"django/db/models/fields/related.py\", line\r\n 2027, in get_col\r\n    return super(ForeignKey, self).get_col(alias, output_field or self.related_field)\r\n  File \"django/db/models/fields/related.py\", line\r\n 1907, in related_field\r\n    return self.foreign_related_fields[0]\r\n  File \"django/db/models/fields/related.py\", line\r\n 1641, in foreign_related_fields\r\n    return tuple(rhs_field for lhs_field, rhs_field in self.related_fields if rhs_field)\r\n  File \"django/db/models/fields/related.py\", line\r\n 1628, in related_fields\r\n    self._related_fields = self.resolve_related_fields()\r\n  File \"django/db/models/fields/related.py\", line\r\n 1613, in resolve_related_fields\r\n    raise ValueError('Related model %r cannot be resolved' % self.rel.to)\r\nValueError: Related model 'profile.ProjectUser' cannot be resolved\r\n```\r\n\r\n\r\n\r\nedit:\r\nAdded a print to line 1613 in `django/db/models/fields/related.py`\r\n```                                                      \r\nprint(self.rel)                                                           \r\nprint(self.rel.to)                                                        \r\n```\r\n\r\nWhen celery starts I get these (related) messages\r\n```\r\n<ManyToOneRel: exercise.submission>\r\n<class 'assignment.models.Assignment'>\r\n```\r\n\r\nHowever when I start up the webserver (`./manage.py runserver`) I get the missing relation\r\n```\r\n<ManyToOneRel: exercise.submission>\r\n<class 'assignment.models.Assignment'>\r\n<ManyToOneRel: exercise.submission>\r\n<class 'profile.models.ProjectUser'>\r\n```"},"comment":{"url":"https://api.github.com/repos/celery/celery/issues/comments/229598178","html_url":"https://github.com/celery/celery/issues/3048#issuecomment-229598178","issue_url":"https://api.github.com/repos/celery/celery/issues/3048","id":229598178,"user":{"login":"kviktor","id":1112058,"avatar_url":"https://avatars.githubusercontent.com/u/1112058?v=3","gravatar_id":"","url":"https://api.github.com/users/kviktor","html_url":"https://github.com/kviktor","followers_url":"https://api.github.com/users/kviktor/followers","following_url":"https://api.github.com/users/kviktor/following{/other_user}","gists_url":"https://api.github.com/users/kviktor/gists{/gist_id}","starred_url":"https://api.github.com/users/kviktor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kviktor/subscriptions","organizations_url":"https://api.github.com/users/kviktor/orgs","repos_url":"https://api.github.com/users/kviktor/repos","events_url":"https://api.github.com/users/kviktor/events{/privacy}","received_events_url":"https://api.github.com/users/kviktor/received_events","type":"User","site_admin":false},"created_at":"2016-06-30T08:40:58Z","updated_at":"2016-06-30T08:40:58Z","body":"The problem still happens but the title of this issue is wrong, the main issue is kinda rare tho, you need to be kinda unlucky to name your models the way I did."}}
{"actor":{"display_login":"kviktor"}}