{"action":"created","comment":{"url":"https://api.github.com/repos/inveniosoftware/invenio-celery/pulls/comments/44258450","id":44258450,"diff_hunk":"@@ -28,22 +28,34 @@\n \n import time\n \n+import pkg_resources\n from flask_celeryext import FlaskCeleryExt\n \n \n class InvenioCelery(object):\n-    \"\"\"Invenio theme extension.\"\"\"\n+    \"\"\"Invenio celery extension.\"\"\"\n \n     def __init__(self, app=None, **kwargs):\n         \"\"\"Extension initialization.\"\"\"\n         self.celery = None\n+\n         if app:\n             self.init_app(app, **kwargs)\n \n-    def init_app(self, app, assets=None, **kwargs):\n+    def init_app(self, app, assets=None,\n+                 entrypoint_name=\"invenio_celery.tasks\", **kwargs):\n         \"\"\"Initialize application object.\"\"\"\n         self.init_config(app.config)\n         self.celery = FlaskCeleryExt(app).celery\n+\n+        if entrypoint_name:\n+            all_modules = []\n+            for item in pkg_resources.iter_entry_points(\n+                    group=entrypoint_name):\n+                all_modules.append(item.module_name)\n+\n+            self.celery.autodiscover_tasks(all_modules, related_name=\"\",","path":"invenio_celery/ext.py","position":32,"original_position":32,"commit_id":"f54e3b29d3d05f1b594d8c99c14f6883c0645101","original_commit_id":"f54e3b29d3d05f1b594d8c99c14f6883c0645101","user":{"login":"jirikuncar","id":189798,"avatar_url":"https://avatars.githubusercontent.com/u/189798?v=3","gravatar_id":"","url":"https://api.github.com/users/jirikuncar","html_url":"https://github.com/jirikuncar","followers_url":"https://api.github.com/users/jirikuncar/followers","following_url":"https://api.github.com/users/jirikuncar/following{/other_user}","gists_url":"https://api.github.com/users/jirikuncar/gists{/gist_id}","starred_url":"https://api.github.com/users/jirikuncar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jirikuncar/subscriptions","organizations_url":"https://api.github.com/users/jirikuncar/orgs","repos_url":"https://api.github.com/users/jirikuncar/repos","events_url":"https://api.github.com/users/jirikuncar/events{/privacy}","received_events_url":"https://api.github.com/users/jirikuncar/received_events","type":"User","site_admin":false},"body":"IMHO it's not necessary to call celery autodiscover tasks if `all_modules` is empty. @bruno314 please consider renaming `all_modules` to `task_packages`.\r\n\r\n","created_at":"2015-11-09T10:14:07Z","updated_at":"2015-11-09T10:14:07Z","html_url":"https://github.com/inveniosoftware/invenio-celery/pull/10#discussion_r44258450","pull_request_url":"https://api.github.com/repos/inveniosoftware/invenio-celery/pulls/10","_links":{"self":{"href":"https://api.github.com/repos/inveniosoftware/invenio-celery/pulls/comments/44258450"},"html":{"href":"https://github.com/inveniosoftware/invenio-celery/pull/10#discussion_r44258450"},"pull_request":{"href":"https://api.github.com/repos/inveniosoftware/invenio-celery/pulls/10"}}},"pull_request":{"url":"https://api.github.com/repos/inveniosoftware/invenio-celery/pulls/10","id":49271803,"html_url":"https://github.com/inveniosoftware/invenio-celery/pull/10","diff_url":"https://github.com/inveniosoftware/invenio-celery/pull/10.diff","patch_url":"https://github.com/inveniosoftware/invenio-celery/pull/10.patch","issue_url":"https://api.github.com/repos/inveniosoftware/invenio-celery/issues/10","number":10,"state":"open","locked":false,"title":"WIP ext: loading of shared tasks via entry_points","user":{"login":"bruno314","id":3518813,"avatar_url":"https://avatars.githubusercontent.com/u/3518813?v=3","gravatar_id":"","url":"https://api.github.com/users/bruno314","html_url":"https://github.com/bruno314","followers_url":"https://api.github.com/users/bruno314/followers","following_url":"https://api.github.com/users/bruno314/following{/other_user}","gists_url":"https://api.github.com/users/bruno314/gists{/gist_id}","starred_url":"https://api.github.com/users/bruno314/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bruno314/subscriptions","organizations_url":"https://api.github.com/users/bruno314/orgs","repos_url":"https://api.github.com/users/bruno314/repos","events_url":"https://api.github.com/users/bruno314/events{/privacy}","received_events_url":"https://api.github.com/users/bruno314/received_events","type":"User","site_admin":false},"body":"work in progress","created_at":"2015-10-30T13:56:31Z","updated_at":"2015-11-09T10:14:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"28f386752c20535db066c94269e615d9cc919daf","assignee":{"login":"bruno314","id":3518813,"avatar_url":"https://avatars.githubusercontent.com/u/3518813?v=3","gravatar_id":"","url":"https://api.github.com/users/bruno314","html_url":"https://github.com/bruno314","followers_url":"https://api.github.com/users/bruno314/followers","following_url":"https://api.github.com/users/bruno314/following{/other_user}","gists_url":"https://api.github.com/users/bruno314/gists{/gist_id}","starred_url":"https://api.github.com/users/bruno314/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bruno314/subscriptions","organizations_url":"https://api.github.com/users/bruno314/orgs","repos_url":"https://api.github.com/users/bruno314/repos","events_url":"https://api.github.com/users/bruno314/events{/privacy}","received_events_url":"https://api.github.com/users/bruno314/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/inveniosoftware/invenio-celery/milestones/3","html_url":"https://github.com/inveniosoftware/invenio-celery/milestones/v1.0.0","labels_url":"https://api.github.com/repos/inveniosoftware/invenio-celery/milestones/3/labels","id":1343081,"number":3,"title":"v1.0.0","description":null,"creator":{"login":"jirikuncar","id":189798,"avatar_url":"https://avatars.githubusercontent.com/u/189798?v=3","gravatar_id":"","url":"https://api.github.com/users/jirikuncar","html_url":"https://github.com/jirikuncar","followers_url":"https://api.github.com/users/jirikuncar/followers","following_url":"https://api.github.com/users/jirikuncar/following{/other_user}","gists_url":"https://api.github.com/users/jirikuncar/gists{/gist_id}","starred_url":"https://api.github.com/users/jirikuncar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jirikuncar/subscriptions","organizations_url":"https://api.github.com/users/jirikuncar/orgs","repos_url":"https://api.github.com/users/jirikuncar/repos","events_url":"https://api.github.com/users/jirikuncar/events{/privacy}","received_events_url":"https://api.github.com/users/jirikuncar/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":3,"state":"open","created_at":"2015-10-07T16:45:30Z","updated_at":"2015-11-01T21:33:05Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/inveniosoftware/invenio-celery/pulls/10/commits","review_comments_url":"https://api.github.com/repos/inveniosoftware/invenio-celery/pulls/10/comments","review_comment_url":"https://api.github.com/repos/inveniosoftware/invenio-celery/pulls/comments{/number}","comments_url":"https://api.github.com/repos/inveniosoftware/invenio-celery/issues/10/comments","statuses_url":"https://api.github.com/repos/inveniosoftware/invenio-celery/statuses/f54e3b29d3d05f1b594d8c99c14f6883c0645101","head":{"label":"bruno314:shared-tasks","ref":"shared-tasks","sha":"f54e3b29d3d05f1b594d8c99c14f6883c0645101","user":{"login":"bruno314","id":3518813,"avatar_url":"https://avatars.githubusercontent.com/u/3518813?v=3","gravatar_id":"","url":"https://api.github.com/users/bruno314","html_url":"https://github.com/bruno314","followers_url":"https://api.github.com/users/bruno314/followers","following_url":"https://api.github.com/users/bruno314/following{/other_user}","gists_url":"https://api.github.com/users/bruno314/gists{/gist_id}","starred_url":"https://api.github.com/users/bruno314/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bruno314/subscriptions","organizations_url":"https://api.github.com/users/bruno314/orgs","repos_url":"https://api.github.com/users/bruno314/repos","events_url":"https://api.github.com/users/bruno314/events{/privacy}","received_events_url":"https://api.github.com/users/bruno314/received_events","type":"User","site_admin":false},"repo":{"id":45179712,"name":"invenio-celery","full_name":"bruno314/invenio-celery","owner":{"login":"bruno314","id":3518813,"avatar_url":"https://avatars.githubusercontent.com/u/3518813?v=3","gravatar_id":"","url":"https://api.github.com/users/bruno314","html_url":"https://github.com/bruno314","followers_url":"https://api.github.com/users/bruno314/followers","following_url":"https://api.github.com/users/bruno314/following{/other_user}","gists_url":"https://api.github.com/users/bruno314/gists{/gist_id}","starred_url":"https://api.github.com/users/bruno314/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bruno314/subscriptions","organizations_url":"https://api.github.com/users/bruno314/orgs","repos_url":"https://api.github.com/users/bruno314/repos","events_url":"https://api.github.com/users/bruno314/events{/privacy}","received_events_url":"https://api.github.com/users/bruno314/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bruno314/invenio-celery","description":"Integration layer between Celery and Invenio.","fork":true,"url":"https://api.github.com/repos/bruno314/invenio-celery","forks_url":"https://api.github.com/repos/bruno314/invenio-celery/forks","keys_url":"https://api.github.com/repos/bruno314/invenio-celery/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bruno314/invenio-celery/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bruno314/invenio-celery/teams","hooks_url":"https://api.github.com/repos/bruno314/invenio-celery/hooks","issue_events_url":"https://api.github.com/repos/bruno314/invenio-celery/issues/events{/number}","events_url":"https://api.github.com/repos/bruno314/invenio-celery/events","assignees_url":"https://api.github.com/repos/bruno314/invenio-celery/assignees{/user}","branches_url":"https://api.github.com/repos/bruno314/invenio-celery/branches{/branch}","tags_url":"https://api.github.com/repos/bruno314/invenio-celery/tags","blobs_url":"https://api.github.com/repos/bruno314/invenio-celery/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bruno314/invenio-celery/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bruno314/invenio-celery/git/refs{/sha}","trees_url":"https://api.github.com/repos/bruno314/invenio-celery/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bruno314/invenio-celery/statuses/{sha}","languages_url":"https://api.github.com/repos/bruno314/invenio-celery/languages","stargazers_url":"https://api.github.com/repos/bruno314/invenio-celery/stargazers","contributors_url":"https://api.github.com/repos/bruno314/invenio-celery/contributors","subscribers_url":"https://api.github.com/repos/bruno314/invenio-celery/subscribers","subscription_url":"https://api.github.com/repos/bruno314/invenio-celery/subscription","commits_url":"https://api.github.com/repos/bruno314/invenio-celery/commits{/sha}","git_commits_url":"https://api.github.com/repos/bruno314/invenio-celery/git/commits{/sha}","comments_url":"https://api.github.com/repos/bruno314/invenio-celery/comments{/number}","issue_comment_url":"https://api.github.com/repos/bruno314/invenio-celery/issues/comments{/number}","contents_url":"https://api.github.com/repos/bruno314/invenio-celery/contents/{+path}","compare_url":"https://api.github.com/repos/bruno314/invenio-celery/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bruno314/invenio-celery/merges","archive_url":"https://api.github.com/repos/bruno314/invenio-celery/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bruno314/invenio-celery/downloads","issues_url":"https://api.github.com/repos/bruno314/invenio-celery/issues{/number}","pulls_url":"https://api.github.com/repos/bruno314/invenio-celery/pulls{/number}","milestones_url":"https://api.github.com/repos/bruno314/invenio-celery/milestones{/number}","notifications_url":"https://api.github.com/repos/bruno314/invenio-celery/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bruno314/invenio-celery/labels{/name}","releases_url":"https://api.github.com/repos/bruno314/invenio-celery/releases{/id}","created_at":"2015-10-29T11:46:20Z","updated_at":"2015-10-29T11:46:21Z","pushed_at":"2015-11-09T10:00:44Z","git_url":"git://github.com/bruno314/invenio-celery.git","ssh_url":"git@github.com:bruno314/invenio-celery.git","clone_url":"https://github.com/bruno314/invenio-celery.git","svn_url":"https://github.com/bruno314/invenio-celery","homepage":null,"size":180,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"inveniosoftware:master","ref":"master","sha":"ae18a5901ab1e0367d77128cfd97e44fd3ca2918","user":{"login":"inveniosoftware","id":1157480,"avatar_url":"https://avatars.githubusercontent.com/u/1157480?v=3","gravatar_id":"","url":"https://api.github.com/users/inveniosoftware","html_url":"https://github.com/inveniosoftware","followers_url":"https://api.github.com/users/inveniosoftware/followers","following_url":"https://api.github.com/users/inveniosoftware/following{/other_user}","gists_url":"https://api.github.com/users/inveniosoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/inveniosoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inveniosoftware/subscriptions","organizations_url":"https://api.github.com/users/inveniosoftware/orgs","repos_url":"https://api.github.com/users/inveniosoftware/repos","events_url":"https://api.github.com/users/inveniosoftware/events{/privacy}","received_events_url":"https://api.github.com/users/inveniosoftware/received_events","type":"Organization","site_admin":false},"repo":{"id":42721045,"name":"invenio-celery","full_name":"inveniosoftware/invenio-celery","owner":{"login":"inveniosoftware","id":1157480,"avatar_url":"https://avatars.githubusercontent.com/u/1157480?v=3","gravatar_id":"","url":"https://api.github.com/users/inveniosoftware","html_url":"https://github.com/inveniosoftware","followers_url":"https://api.github.com/users/inveniosoftware/followers","following_url":"https://api.github.com/users/inveniosoftware/following{/other_user}","gists_url":"https://api.github.com/users/inveniosoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/inveniosoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inveniosoftware/subscriptions","organizations_url":"https://api.github.com/users/inveniosoftware/orgs","repos_url":"https://api.github.com/users/inveniosoftware/repos","events_url":"https://api.github.com/users/inveniosoftware/events{/privacy}","received_events_url":"https://api.github.com/users/inveniosoftware/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/inveniosoftware/invenio-celery","description":"Integration layer between Celery and Invenio.","fork":false,"url":"https://api.github.com/repos/inveniosoftware/invenio-celery","forks_url":"https://api.github.com/repos/inveniosoftware/invenio-celery/forks","keys_url":"https://api.github.com/repos/inveniosoftware/invenio-celery/keys{/key_id}","collaborators_url":"https://api.github.com/repos/inveniosoftware/invenio-celery/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/inveniosoftware/invenio-celery/teams","hooks_url":"https://api.github.com/repos/inveniosoftware/invenio-celery/hooks","issue_events_url":"https://api.github.com/repos/inveniosoftware/invenio-celery/issues/events{/number}","events_url":"https://api.github.com/repos/inveniosoftware/invenio-celery/events","assignees_url":"https://api.github.com/repos/inveniosoftware/invenio-celery/assignees{/user}","branches_url":"https://api.github.com/repos/inveniosoftware/invenio-celery/branches{/branch}","tags_url":"https://api.github.com/repos/inveniosoftware/invenio-celery/tags","blobs_url":"https://api.github.com/repos/inveniosoftware/invenio-celery/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/inveniosoftware/invenio-celery/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/inveniosoftware/invenio-celery/git/refs{/sha}","trees_url":"https://api.github.com/repos/inveniosoftware/invenio-celery/git/trees{/sha}","statuses_url":"https://api.github.com/repos/inveniosoftware/invenio-celery/statuses/{sha}","languages_url":"https://api.github.com/repos/inveniosoftware/invenio-celery/languages","stargazers_url":"https://api.github.com/repos/inveniosoftware/invenio-celery/stargazers","contributors_url":"https://api.github.com/repos/inveniosoftware/invenio-celery/contributors","subscribers_url":"https://api.github.com/repos/inveniosoftware/invenio-celery/subscribers","subscription_url":"https://api.github.com/repos/inveniosoftware/invenio-celery/subscription","commits_url":"https://api.github.com/repos/inveniosoftware/invenio-celery/commits{/sha}","git_commits_url":"https://api.github.com/repos/inveniosoftware/invenio-celery/git/commits{/sha}","comments_url":"https://api.github.com/repos/inveniosoftware/invenio-celery/comments{/number}","issue_comment_url":"https://api.github.com/repos/inveniosoftware/invenio-celery/issues/comments{/number}","contents_url":"https://api.github.com/repos/inveniosoftware/invenio-celery/contents/{+path}","compare_url":"https://api.github.com/repos/inveniosoftware/invenio-celery/compare/{base}...{head}","merges_url":"https://api.github.com/repos/inveniosoftware/invenio-celery/merges","archive_url":"https://api.github.com/repos/inveniosoftware/invenio-celery/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/inveniosoftware/invenio-celery/downloads","issues_url":"https://api.github.com/repos/inveniosoftware/invenio-celery/issues{/number}","pulls_url":"https://api.github.com/repos/inveniosoftware/invenio-celery/pulls{/number}","milestones_url":"https://api.github.com/repos/inveniosoftware/invenio-celery/milestones{/number}","notifications_url":"https://api.github.com/repos/inveniosoftware/invenio-celery/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/inveniosoftware/invenio-celery/labels{/name}","releases_url":"https://api.github.com/repos/inveniosoftware/invenio-celery/releases{/id}","created_at":"2015-09-18T12:35:52Z","updated_at":"2015-09-21T06:57:24Z","pushed_at":"2015-11-09T10:00:44Z","git_url":"git://github.com/inveniosoftware/invenio-celery.git","ssh_url":"git@github.com:inveniosoftware/invenio-celery.git","clone_url":"https://github.com/inveniosoftware/invenio-celery.git","svn_url":"https://github.com/inveniosoftware/invenio-celery","homepage":null,"size":482,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":2,"forks":7,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/inveniosoftware/invenio-celery/pulls/10"},"html":{"href":"https://github.com/inveniosoftware/invenio-celery/pull/10"},"issue":{"href":"https://api.github.com/repos/inveniosoftware/invenio-celery/issues/10"},"comments":{"href":"https://api.github.com/repos/inveniosoftware/invenio-celery/issues/10/comments"},"review_comments":{"href":"https://api.github.com/repos/inveniosoftware/invenio-celery/pulls/10/comments"},"review_comment":{"href":"https://api.github.com/repos/inveniosoftware/invenio-celery/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/inveniosoftware/invenio-celery/pulls/10/commits"},"statuses":{"href":"https://api.github.com/repos/inveniosoftware/invenio-celery/statuses/f54e3b29d3d05f1b594d8c99c14f6883c0645101"}}}}