{"action":"created","issue":{"url":"https://api.github.com/repos/pallets/flask/issues/2055","repository_url":"https://api.github.com/repos/pallets/flask","labels_url":"https://api.github.com/repos/pallets/flask/issues/2055/labels{/name}","comments_url":"https://api.github.com/repos/pallets/flask/issues/2055/comments","events_url":"https://api.github.com/repos/pallets/flask/issues/2055/events","html_url":"https://github.com/pallets/flask/pull/2055","id":182264901,"number":2055,"title":"Updated Celery pattern","user":{"login":"lght","id":1404977,"avatar_url":"https://avatars.githubusercontent.com/u/1404977?v=3","gravatar_id":"","url":"https://api.github.com/users/lght","html_url":"https://github.com/lght","followers_url":"https://api.github.com/users/lght/followers","following_url":"https://api.github.com/users/lght/following{/other_user}","gists_url":"https://api.github.com/users/lght/gists{/gist_id}","starred_url":"https://api.github.com/users/lght/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lght/subscriptions","organizations_url":"https://api.github.com/users/lght/orgs","repos_url":"https://api.github.com/users/lght/repos","events_url":"https://api.github.com/users/lght/events{/privacy}","received_events_url":"https://api.github.com/users/lght/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-10-11T13:32:48Z","updated_at":"2016-10-12T17:31:27Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/pallets/flask/pulls/2055","html_url":"https://github.com/pallets/flask/pull/2055","diff_url":"https://github.com/pallets/flask/pull/2055.diff","patch_url":"https://github.com/pallets/flask/pull/2055.patch"},"body":"The given pattern caused Celery to lose the current Context.\r\n\r\n```\r\n> ~/celery/app/task.py(424)__call__()\r\n-> try:\r\n(Pdb) p self.request\r\n<Context: {}>\r\n``` \r\n\r\nAnd with this new pattern:\r\n\r\n```\r\n(Pdb) p self.request\r\n<Context: {'called_directly': False, 'retries': 5, 'is_eager': True, 'loglevel': 0, 'delivery_info': {'is_eager': True}, 'args': (), 'callbacks': None, 'errbacks': None, 'kwargs': {}, 'logfile': None, 'id': '9fbd9fa0-1a42-4e70-9c52-558ad3bc9d72', 'headers': None}>\r\n```\r\n\r\nNote that I'm using Celery 3.1.24. The current pattern may be outdated (last change was 2013)"},"comment":{"url":"https://api.github.com/repos/pallets/flask/issues/comments/253281728","html_url":"https://github.com/pallets/flask/pull/2055#issuecomment-253281728","issue_url":"https://api.github.com/repos/pallets/flask/issues/2055","id":253281728,"user":{"login":"lght","id":1404977,"avatar_url":"https://avatars.githubusercontent.com/u/1404977?v=3","gravatar_id":"","url":"https://api.github.com/users/lght","html_url":"https://github.com/lght","followers_url":"https://api.github.com/users/lght/followers","following_url":"https://api.github.com/users/lght/following{/other_user}","gists_url":"https://api.github.com/users/lght/gists{/gist_id}","starred_url":"https://api.github.com/users/lght/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lght/subscriptions","organizations_url":"https://api.github.com/users/lght/orgs","repos_url":"https://api.github.com/users/lght/repos","events_url":"https://api.github.com/users/lght/events{/privacy}","received_events_url":"https://api.github.com/users/lght/received_events","type":"User","site_admin":false},"created_at":"2016-10-12T17:31:27Z","updated_at":"2016-10-12T17:31:27Z","body":"Speeding things up, you'll find a quick script to see what's actually going on here:\r\n\r\nhttps://gist.github.com/lght/f5fa6e4924739897d9505f14edc5a190\r\n\r\nConsole output:\r\n\r\n```\r\n(venv) > python run.py\r\n * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)\r\n * Restarting with stat\r\n * Debugger is active!\r\n * Debugger pin code: 107-501-531\r\nCurrent context: <Context: {}>\r\n127.0.0.1 - - [12/Oct/2016 19:28:30] \"GET /task HTTP/1.1\" 200 -\r\nCurrent context: <Context: {'called_directly': False, 'delivery_info': {'is_eager': True}, 'id': '8d6c3c25-e2c8-4b2e-a39e-736dbf4f973a', 'loglevel': 0, 'kwargs': {}, 'is_eager': True, 'headers': None, 'callbacks': None, 'errbacks': None, 'retries': 0, 'logfile': None, 'args': ()}>\r\n127.0.0.1 - - [12/Oct/2016 19:28:34] \"GET /new_task HTTP/1.1\" 200 -\r\n^C%  \r\n```\r\n\r\nFirst context is the one with `__call__` pattern, second one is with `run` pattern.\r\n\r\n"}}
{"actor":{"display_login":"lght"}}