{"action":"closed","number":3275,"pull_request":{"url":"https://api.github.com/repos/celery/celery/pulls/3275","id":75114511,"html_url":"https://github.com/celery/celery/pull/3275","diff_url":"https://github.com/celery/celery/pull/3275.diff","patch_url":"https://github.com/celery/celery/pull/3275.patch","issue_url":"https://api.github.com/repos/celery/celery/issues/3275","number":3275,"state":"closed","locked":false,"title":"Add signal: `heartbeat`","user":{"login":"kfr2","id":410310,"avatar_url":"https://avatars.githubusercontent.com/u/410310?v=3","gravatar_id":"","url":"https://api.github.com/users/kfr2","html_url":"https://github.com/kfr2","followers_url":"https://api.github.com/users/kfr2/followers","following_url":"https://api.github.com/users/kfr2/following{/other_user}","gists_url":"https://api.github.com/users/kfr2/gists{/gist_id}","starred_url":"https://api.github.com/users/kfr2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kfr2/subscriptions","organizations_url":"https://api.github.com/users/kfr2/orgs","repos_url":"https://api.github.com/users/kfr2/repos","events_url":"https://api.github.com/users/kfr2/events{/privacy}","received_events_url":"https://api.github.com/users/kfr2/received_events","type":"User","site_admin":false},"body":"* :data:`celery.signals.heartbeat`\r\n\r\n     Dispatched when Celery sends a worker heartbeat.\r\n     Sender is the :class:`celery.worker.heartbeat.Heart` instance.\r\n\r\n---\r\n\r\nI am interested in having a Celery worker regularly perform an action. In this specific case, I want the worker to update its corresponding health check in Consul. Thus, this change adds the `heartbeat` signal to allow a user to tap into Celery's heartbeat process to perform an action on a regular interval.\r\n\r\nFor instance, this signal might be used in the following manner:\r\n\r\n```\r\nimport consul\r\nfrom celery.signals import heartbeat\r\n\r\n\r\nconsul_client = consul.Consul(host='consul')\r\n\r\n\r\n@heartbeat.connect\r\ndef notify_consul(sender=None, conf=None, **kwargs):\r\n    consul_client.agent.check.ttl_pass('service:xyz')\r\n```\r\n\r\nI'm not aware of any existing mechanisms Celery might have to implement such a feature (nor do I know the overhead of adding a signal that may be called many times per minute) so please let me know if this feature does not make sense or could be implemented in a better way.","created_at":"2016-06-24T13:33:42Z","updated_at":"2016-06-30T00:15:25Z","closed_at":"2016-06-30T00:15:25Z","merged_at":null,"merge_commit_sha":"5336ecbbc19b22b1700fa6b26a7bb2afb33a6b13","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/celery/celery/pulls/3275/commits","review_comments_url":"https://api.github.com/repos/celery/celery/pulls/3275/comments","review_comment_url":"https://api.github.com/repos/celery/celery/pulls/comments{/number}","comments_url":"https://api.github.com/repos/celery/celery/issues/3275/comments","statuses_url":"https://api.github.com/repos/celery/celery/statuses/bc774fecba0691b77b070e72685262063842e38c","head":{"label":"kfr2:add-heartbeat-signal","ref":"add-heartbeat-signal","sha":"bc774fecba0691b77b070e72685262063842e38c","user":{"login":"kfr2","id":410310,"avatar_url":"https://avatars.githubusercontent.com/u/410310?v=3","gravatar_id":"","url":"https://api.github.com/users/kfr2","html_url":"https://github.com/kfr2","followers_url":"https://api.github.com/users/kfr2/followers","following_url":"https://api.github.com/users/kfr2/following{/other_user}","gists_url":"https://api.github.com/users/kfr2/gists{/gist_id}","starred_url":"https://api.github.com/users/kfr2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kfr2/subscriptions","organizations_url":"https://api.github.com/users/kfr2/orgs","repos_url":"https://api.github.com/users/kfr2/repos","events_url":"https://api.github.com/users/kfr2/events{/privacy}","received_events_url":"https://api.github.com/users/kfr2/received_events","type":"User","site_admin":false},"repo":{"id":61884551,"name":"celery","full_name":"kfr2/celery","owner":{"login":"kfr2","id":410310,"avatar_url":"https://avatars.githubusercontent.com/u/410310?v=3","gravatar_id":"","url":"https://api.github.com/users/kfr2","html_url":"https://github.com/kfr2","followers_url":"https://api.github.com/users/kfr2/followers","following_url":"https://api.github.com/users/kfr2/following{/other_user}","gists_url":"https://api.github.com/users/kfr2/gists{/gist_id}","starred_url":"https://api.github.com/users/kfr2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kfr2/subscriptions","organizations_url":"https://api.github.com/users/kfr2/orgs","repos_url":"https://api.github.com/users/kfr2/repos","events_url":"https://api.github.com/users/kfr2/events{/privacy}","received_events_url":"https://api.github.com/users/kfr2/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kfr2/celery","description":"Distributed Task Queue (development branch)","fork":true,"url":"https://api.github.com/repos/kfr2/celery","forks_url":"https://api.github.com/repos/kfr2/celery/forks","keys_url":"https://api.github.com/repos/kfr2/celery/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kfr2/celery/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kfr2/celery/teams","hooks_url":"https://api.github.com/repos/kfr2/celery/hooks","issue_events_url":"https://api.github.com/repos/kfr2/celery/issues/events{/number}","events_url":"https://api.github.com/repos/kfr2/celery/events","assignees_url":"https://api.github.com/repos/kfr2/celery/assignees{/user}","branches_url":"https://api.github.com/repos/kfr2/celery/branches{/branch}","tags_url":"https://api.github.com/repos/kfr2/celery/tags","blobs_url":"https://api.github.com/repos/kfr2/celery/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kfr2/celery/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kfr2/celery/git/refs{/sha}","trees_url":"https://api.github.com/repos/kfr2/celery/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kfr2/celery/statuses/{sha}","languages_url":"https://api.github.com/repos/kfr2/celery/languages","stargazers_url":"https://api.github.com/repos/kfr2/celery/stargazers","contributors_url":"https://api.github.com/repos/kfr2/celery/contributors","subscribers_url":"https://api.github.com/repos/kfr2/celery/subscribers","subscription_url":"https://api.github.com/repos/kfr2/celery/subscription","commits_url":"https://api.github.com/repos/kfr2/celery/commits{/sha}","git_commits_url":"https://api.github.com/repos/kfr2/celery/git/commits{/sha}","comments_url":"https://api.github.com/repos/kfr2/celery/comments{/number}","issue_comment_url":"https://api.github.com/repos/kfr2/celery/issues/comments{/number}","contents_url":"https://api.github.com/repos/kfr2/celery/contents/{+path}","compare_url":"https://api.github.com/repos/kfr2/celery/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kfr2/celery/merges","archive_url":"https://api.github.com/repos/kfr2/celery/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kfr2/celery/downloads","issues_url":"https://api.github.com/repos/kfr2/celery/issues{/number}","pulls_url":"https://api.github.com/repos/kfr2/celery/pulls{/number}","milestones_url":"https://api.github.com/repos/kfr2/celery/milestones{/number}","notifications_url":"https://api.github.com/repos/kfr2/celery/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kfr2/celery/labels{/name}","releases_url":"https://api.github.com/repos/kfr2/celery/releases{/id}","deployments_url":"https://api.github.com/repos/kfr2/celery/deployments","created_at":"2016-06-24T12:56:07Z","updated_at":"2016-06-24T12:56:15Z","pushed_at":"2016-06-24T13:25:50Z","git_url":"git://github.com/kfr2/celery.git","ssh_url":"git@github.com:kfr2/celery.git","clone_url":"https://github.com/kfr2/celery.git","svn_url":"https://github.com/kfr2/celery","homepage":"http://celeryproject.org","size":42851,"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":"celery:master","ref":"master","sha":"a1f04339b53f078ce4810e6b7c365ea72e826104","user":{"login":"celery","id":319983,"avatar_url":"https://avatars.githubusercontent.com/u/319983?v=3","gravatar_id":"","url":"https://api.github.com/users/celery","html_url":"https://github.com/celery","followers_url":"https://api.github.com/users/celery/followers","following_url":"https://api.github.com/users/celery/following{/other_user}","gists_url":"https://api.github.com/users/celery/gists{/gist_id}","starred_url":"https://api.github.com/users/celery/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/celery/subscriptions","organizations_url":"https://api.github.com/users/celery/orgs","repos_url":"https://api.github.com/users/celery/repos","events_url":"https://api.github.com/users/celery/events{/privacy}","received_events_url":"https://api.github.com/users/celery/received_events","type":"Organization","site_admin":false},"repo":{"id":184460,"name":"celery","full_name":"celery/celery","owner":{"login":"celery","id":319983,"avatar_url":"https://avatars.githubusercontent.com/u/319983?v=3","gravatar_id":"","url":"https://api.github.com/users/celery","html_url":"https://github.com/celery","followers_url":"https://api.github.com/users/celery/followers","following_url":"https://api.github.com/users/celery/following{/other_user}","gists_url":"https://api.github.com/users/celery/gists{/gist_id}","starred_url":"https://api.github.com/users/celery/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/celery/subscriptions","organizations_url":"https://api.github.com/users/celery/orgs","repos_url":"https://api.github.com/users/celery/repos","events_url":"https://api.github.com/users/celery/events{/privacy}","received_events_url":"https://api.github.com/users/celery/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/celery/celery","description":"Distributed Task Queue (development branch)","fork":false,"url":"https://api.github.com/repos/celery/celery","forks_url":"https://api.github.com/repos/celery/celery/forks","keys_url":"https://api.github.com/repos/celery/celery/keys{/key_id}","collaborators_url":"https://api.github.com/repos/celery/celery/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/celery/celery/teams","hooks_url":"https://api.github.com/repos/celery/celery/hooks","issue_events_url":"https://api.github.com/repos/celery/celery/issues/events{/number}","events_url":"https://api.github.com/repos/celery/celery/events","assignees_url":"https://api.github.com/repos/celery/celery/assignees{/user}","branches_url":"https://api.github.com/repos/celery/celery/branches{/branch}","tags_url":"https://api.github.com/repos/celery/celery/tags","blobs_url":"https://api.github.com/repos/celery/celery/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/celery/celery/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/celery/celery/git/refs{/sha}","trees_url":"https://api.github.com/repos/celery/celery/git/trees{/sha}","statuses_url":"https://api.github.com/repos/celery/celery/statuses/{sha}","languages_url":"https://api.github.com/repos/celery/celery/languages","stargazers_url":"https://api.github.com/repos/celery/celery/stargazers","contributors_url":"https://api.github.com/repos/celery/celery/contributors","subscribers_url":"https://api.github.com/repos/celery/celery/subscribers","subscription_url":"https://api.github.com/repos/celery/celery/subscription","commits_url":"https://api.github.com/repos/celery/celery/commits{/sha}","git_commits_url":"https://api.github.com/repos/celery/celery/git/commits{/sha}","comments_url":"https://api.github.com/repos/celery/celery/comments{/number}","issue_comment_url":"https://api.github.com/repos/celery/celery/issues/comments{/number}","contents_url":"https://api.github.com/repos/celery/celery/contents/{+path}","compare_url":"https://api.github.com/repos/celery/celery/compare/{base}...{head}","merges_url":"https://api.github.com/repos/celery/celery/merges","archive_url":"https://api.github.com/repos/celery/celery/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/celery/celery/downloads","issues_url":"https://api.github.com/repos/celery/celery/issues{/number}","pulls_url":"https://api.github.com/repos/celery/celery/pulls{/number}","milestones_url":"https://api.github.com/repos/celery/celery/milestones{/number}","notifications_url":"https://api.github.com/repos/celery/celery/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/celery/celery/labels{/name}","releases_url":"https://api.github.com/repos/celery/celery/releases{/id}","deployments_url":"https://api.github.com/repos/celery/celery/deployments","created_at":"2009-04-24T11:31:24Z","updated_at":"2016-06-29T21:41:39Z","pushed_at":"2016-06-30T00:12:59Z","git_url":"git://github.com/celery/celery.git","ssh_url":"git@github.com:celery/celery.git","clone_url":"https://github.com/celery/celery.git","svn_url":"https://github.com/celery/celery","homepage":"http://celeryproject.org","size":50325,"stargazers_count":4946,"watchers_count":4946,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1655,"mirror_url":null,"open_issues_count":100,"forks":1655,"open_issues":100,"watchers":4946,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/celery/celery/pulls/3275"},"html":{"href":"https://github.com/celery/celery/pull/3275"},"issue":{"href":"https://api.github.com/repos/celery/celery/issues/3275"},"comments":{"href":"https://api.github.com/repos/celery/celery/issues/3275/comments"},"review_comments":{"href":"https://api.github.com/repos/celery/celery/pulls/3275/comments"},"review_comment":{"href":"https://api.github.com/repos/celery/celery/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/celery/celery/pulls/3275/commits"},"statuses":{"href":"https://api.github.com/repos/celery/celery/statuses/bc774fecba0691b77b070e72685262063842e38c"}},"merged":false,"mergeable":false,"mergeable_state":"dirty","merged_by":null,"comments":2,"review_comments":0,"commits":1,"additions":14,"deletions":3,"changed_files":3}}
{"actor":{"display_login":"ask"}}