{"action":"created","comment":{"url":"https://api.github.com/repos/golemfactory/golem/pulls/comments/166925647","pull_request_review_id":95062973,"id":166925647,"diff_hunk":"@@ -132,18 +132,49 @@ def get_task_env(self, task_id):\n     @handle_key_error\n     def receive_subtask(self, comp_task_def):\n         logger.debug('CT.receive_subtask()')\n+        if not self.check_comp_task_def(comp_task_def):\n+            return False\n         task = self.active_tasks[comp_task_def['task_id']]\n-        if not task.requests > 0:\n-            return\n-        if comp_task_def['subtask_id'] in task.subtasks:\n-            return\n         task.requests -= 1\n         task.subtasks[comp_task_def['subtask_id']] = comp_task_def\n         self.subtask_to_task[comp_task_def['subtask_id']] =\\\n             comp_task_def['task_id']\n         self.dump()\n         return True\n \n+    def check_comp_task_def(self, comp_task_def):\n+        task = self.active_tasks[comp_task_def['task_id']]\n+\n+        not_accepted_message = \"Cannot accept subtask %s for task %s. \" % \\\n+                               (comp_task_def['subtask_id'],\n+                                comp_task_def['task_id'])","path":"golem/task/taskkeeper.py","position":23,"original_position":23,"commit_id":"79f71a0596bf8d5e752fc100063086a5baef0f6b","original_commit_id":"79f71a0596bf8d5e752fc100063086a5baef0f6b","user":{"login":"jiivan","id":293058,"avatar_url":"https://avatars0.githubusercontent.com/u/293058?v=4","gravatar_id":"","url":"https://api.github.com/users/jiivan","html_url":"https://github.com/jiivan","followers_url":"https://api.github.com/users/jiivan/followers","following_url":"https://api.github.com/users/jiivan/following{/other_user}","gists_url":"https://api.github.com/users/jiivan/gists{/gist_id}","starred_url":"https://api.github.com/users/jiivan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jiivan/subscriptions","organizations_url":"https://api.github.com/users/jiivan/orgs","repos_url":"https://api.github.com/users/jiivan/repos","events_url":"https://api.github.com/users/jiivan/events{/privacy}","received_events_url":"https://api.github.com/users/jiivan/received_events","type":"User","site_admin":false},"body":"To avoid string substitution and concatenation unless it's needed by current loglevel you could:\r\n```python\r\nnot_accepted_message = \"Cannot accept subtask %s for task %s. %s\"\r\nlog_args = [comp_task_def['subtask_id'], comp_task_def['task_id']]\r\n\r\nif not task.requests > 0:\r\n    logger.info(not_accepted_message, *log_args, \"Request for this task was not send.\")","created_at":"2018-02-08T13:00:35Z","updated_at":"2018-02-08T13:02:06Z","html_url":"https://github.com/golemfactory/golem/pull/2065#discussion_r166925647","pull_request_url":"https://api.github.com/repos/golemfactory/golem/pulls/2065","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/golemfactory/golem/pulls/comments/166925647"},"html":{"href":"https://github.com/golemfactory/golem/pull/2065#discussion_r166925647"},"pull_request":{"href":"https://api.github.com/repos/golemfactory/golem/pulls/2065"}}},"pull_request":{"url":"https://api.github.com/repos/golemfactory/golem/pulls/2065","id":167780760,"html_url":"https://github.com/golemfactory/golem/pull/2065","diff_url":"https://github.com/golemfactory/golem/pull/2065.diff","patch_url":"https://github.com/golemfactory/golem/pull/2065.patch","issue_url":"https://api.github.com/repos/golemfactory/golem/issues/2065","number":2065,"state":"open","locked":false,"title":"Check deadline and environment in CompTaskKeeper","user":{"login":"badb","id":483392,"avatar_url":"https://avatars3.githubusercontent.com/u/483392?v=4","gravatar_id":"","url":"https://api.github.com/users/badb","html_url":"https://github.com/badb","followers_url":"https://api.github.com/users/badb/followers","following_url":"https://api.github.com/users/badb/following{/other_user}","gists_url":"https://api.github.com/users/badb/gists{/gist_id}","starred_url":"https://api.github.com/users/badb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/badb/subscriptions","organizations_url":"https://api.github.com/users/badb/orgs","repos_url":"https://api.github.com/users/badb/repos","events_url":"https://api.github.com/users/badb/events{/privacy}","received_events_url":"https://api.github.com/users/badb/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-02-07T19:03:42Z","updated_at":"2018-02-08T13:02:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"81ce01b736c3d1c477ca0efc4ff5cad7dbfb735d","assignee":null,"assignees":[],"requested_reviewers":[{"login":"etam","id":220752,"avatar_url":"https://avatars1.githubusercontent.com/u/220752?v=4","gravatar_id":"","url":"https://api.github.com/users/etam","html_url":"https://github.com/etam","followers_url":"https://api.github.com/users/etam/followers","following_url":"https://api.github.com/users/etam/following{/other_user}","gists_url":"https://api.github.com/users/etam/gists{/gist_id}","starred_url":"https://api.github.com/users/etam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/etam/subscriptions","organizations_url":"https://api.github.com/users/etam/orgs","repos_url":"https://api.github.com/users/etam/repos","events_url":"https://api.github.com/users/etam/events{/privacy}","received_events_url":"https://api.github.com/users/etam/received_events","type":"User","site_admin":false}],"requested_teams":[],"milestone":null,"commits_url":"https://api.github.com/repos/golemfactory/golem/pulls/2065/commits","review_comments_url":"https://api.github.com/repos/golemfactory/golem/pulls/2065/comments","review_comment_url":"https://api.github.com/repos/golemfactory/golem/pulls/comments{/number}","comments_url":"https://api.github.com/repos/golemfactory/golem/issues/2065/comments","statuses_url":"https://api.github.com/repos/golemfactory/golem/statuses/79f71a0596bf8d5e752fc100063086a5baef0f6b","head":{"label":"golemfactory:comp_task_keeper_checks","ref":"comp_task_keeper_checks","sha":"79f71a0596bf8d5e752fc100063086a5baef0f6b","user":{"login":"golemfactory","id":23193179,"avatar_url":"https://avatars1.githubusercontent.com/u/23193179?v=4","gravatar_id":"","url":"https://api.github.com/users/golemfactory","html_url":"https://github.com/golemfactory","followers_url":"https://api.github.com/users/golemfactory/followers","following_url":"https://api.github.com/users/golemfactory/following{/other_user}","gists_url":"https://api.github.com/users/golemfactory/gists{/gist_id}","starred_url":"https://api.github.com/users/golemfactory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/golemfactory/subscriptions","organizations_url":"https://api.github.com/users/golemfactory/orgs","repos_url":"https://api.github.com/users/golemfactory/repos","events_url":"https://api.github.com/users/golemfactory/events{/privacy}","received_events_url":"https://api.github.com/users/golemfactory/received_events","type":"Organization","site_admin":false},"repo":{"id":46433937,"name":"golem","full_name":"golemfactory/golem","owner":{"login":"golemfactory","id":23193179,"avatar_url":"https://avatars1.githubusercontent.com/u/23193179?v=4","gravatar_id":"","url":"https://api.github.com/users/golemfactory","html_url":"https://github.com/golemfactory","followers_url":"https://api.github.com/users/golemfactory/followers","following_url":"https://api.github.com/users/golemfactory/following{/other_user}","gists_url":"https://api.github.com/users/golemfactory/gists{/gist_id}","starred_url":"https://api.github.com/users/golemfactory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/golemfactory/subscriptions","organizations_url":"https://api.github.com/users/golemfactory/orgs","repos_url":"https://api.github.com/users/golemfactory/repos","events_url":"https://api.github.com/users/golemfactory/events{/privacy}","received_events_url":"https://api.github.com/users/golemfactory/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/golemfactory/golem","description":"Golem is creating a global market for computing power.","fork":false,"url":"https://api.github.com/repos/golemfactory/golem","forks_url":"https://api.github.com/repos/golemfactory/golem/forks","keys_url":"https://api.github.com/repos/golemfactory/golem/keys{/key_id}","collaborators_url":"https://api.github.com/repos/golemfactory/golem/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/golemfactory/golem/teams","hooks_url":"https://api.github.com/repos/golemfactory/golem/hooks","issue_events_url":"https://api.github.com/repos/golemfactory/golem/issues/events{/number}","events_url":"https://api.github.com/repos/golemfactory/golem/events","assignees_url":"https://api.github.com/repos/golemfactory/golem/assignees{/user}","branches_url":"https://api.github.com/repos/golemfactory/golem/branches{/branch}","tags_url":"https://api.github.com/repos/golemfactory/golem/tags","blobs_url":"https://api.github.com/repos/golemfactory/golem/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/golemfactory/golem/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/golemfactory/golem/git/refs{/sha}","trees_url":"https://api.github.com/repos/golemfactory/golem/git/trees{/sha}","statuses_url":"https://api.github.com/repos/golemfactory/golem/statuses/{sha}","languages_url":"https://api.github.com/repos/golemfactory/golem/languages","stargazers_url":"https://api.github.com/repos/golemfactory/golem/stargazers","contributors_url":"https://api.github.com/repos/golemfactory/golem/contributors","subscribers_url":"https://api.github.com/repos/golemfactory/golem/subscribers","subscription_url":"https://api.github.com/repos/golemfactory/golem/subscription","commits_url":"https://api.github.com/repos/golemfactory/golem/commits{/sha}","git_commits_url":"https://api.github.com/repos/golemfactory/golem/git/commits{/sha}","comments_url":"https://api.github.com/repos/golemfactory/golem/comments{/number}","issue_comment_url":"https://api.github.com/repos/golemfactory/golem/issues/comments{/number}","contents_url":"https://api.github.com/repos/golemfactory/golem/contents/{+path}","compare_url":"https://api.github.com/repos/golemfactory/golem/compare/{base}...{head}","merges_url":"https://api.github.com/repos/golemfactory/golem/merges","archive_url":"https://api.github.com/repos/golemfactory/golem/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/golemfactory/golem/downloads","issues_url":"https://api.github.com/repos/golemfactory/golem/issues{/number}","pulls_url":"https://api.github.com/repos/golemfactory/golem/pulls{/number}","milestones_url":"https://api.github.com/repos/golemfactory/golem/milestones{/number}","notifications_url":"https://api.github.com/repos/golemfactory/golem/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/golemfactory/golem/labels{/name}","releases_url":"https://api.github.com/repos/golemfactory/golem/releases{/id}","deployments_url":"https://api.github.com/repos/golemfactory/golem/deployments","created_at":"2015-11-18T17:02:35Z","updated_at":"2018-02-08T12:18:47Z","pushed_at":"2018-02-08T12:41:19Z","git_url":"git://github.com/golemfactory/golem.git","ssh_url":"git@github.com:golemfactory/golem.git","clone_url":"https://github.com/golemfactory/golem.git","svn_url":"https://github.com/golemfactory/golem","homepage":"https://golem.network","size":78438,"stargazers_count":2169,"watchers_count":2169,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":214,"mirror_url":null,"archived":false,"open_issues_count":258,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0"},"forks":214,"open_issues":258,"watchers":2169,"default_branch":"develop"}},"base":{"label":"golemfactory:develop","ref":"develop","sha":"7e35decda1b4ae285a5ebd2121c8d243a548c011","user":{"login":"golemfactory","id":23193179,"avatar_url":"https://avatars1.githubusercontent.com/u/23193179?v=4","gravatar_id":"","url":"https://api.github.com/users/golemfactory","html_url":"https://github.com/golemfactory","followers_url":"https://api.github.com/users/golemfactory/followers","following_url":"https://api.github.com/users/golemfactory/following{/other_user}","gists_url":"https://api.github.com/users/golemfactory/gists{/gist_id}","starred_url":"https://api.github.com/users/golemfactory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/golemfactory/subscriptions","organizations_url":"https://api.github.com/users/golemfactory/orgs","repos_url":"https://api.github.com/users/golemfactory/repos","events_url":"https://api.github.com/users/golemfactory/events{/privacy}","received_events_url":"https://api.github.com/users/golemfactory/received_events","type":"Organization","site_admin":false},"repo":{"id":46433937,"name":"golem","full_name":"golemfactory/golem","owner":{"login":"golemfactory","id":23193179,"avatar_url":"https://avatars1.githubusercontent.com/u/23193179?v=4","gravatar_id":"","url":"https://api.github.com/users/golemfactory","html_url":"https://github.com/golemfactory","followers_url":"https://api.github.com/users/golemfactory/followers","following_url":"https://api.github.com/users/golemfactory/following{/other_user}","gists_url":"https://api.github.com/users/golemfactory/gists{/gist_id}","starred_url":"https://api.github.com/users/golemfactory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/golemfactory/subscriptions","organizations_url":"https://api.github.com/users/golemfactory/orgs","repos_url":"https://api.github.com/users/golemfactory/repos","events_url":"https://api.github.com/users/golemfactory/events{/privacy}","received_events_url":"https://api.github.com/users/golemfactory/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/golemfactory/golem","description":"Golem is creating a global market for computing power.","fork":false,"url":"https://api.github.com/repos/golemfactory/golem","forks_url":"https://api.github.com/repos/golemfactory/golem/forks","keys_url":"https://api.github.com/repos/golemfactory/golem/keys{/key_id}","collaborators_url":"https://api.github.com/repos/golemfactory/golem/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/golemfactory/golem/teams","hooks_url":"https://api.github.com/repos/golemfactory/golem/hooks","issue_events_url":"https://api.github.com/repos/golemfactory/golem/issues/events{/number}","events_url":"https://api.github.com/repos/golemfactory/golem/events","assignees_url":"https://api.github.com/repos/golemfactory/golem/assignees{/user}","branches_url":"https://api.github.com/repos/golemfactory/golem/branches{/branch}","tags_url":"https://api.github.com/repos/golemfactory/golem/tags","blobs_url":"https://api.github.com/repos/golemfactory/golem/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/golemfactory/golem/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/golemfactory/golem/git/refs{/sha}","trees_url":"https://api.github.com/repos/golemfactory/golem/git/trees{/sha}","statuses_url":"https://api.github.com/repos/golemfactory/golem/statuses/{sha}","languages_url":"https://api.github.com/repos/golemfactory/golem/languages","stargazers_url":"https://api.github.com/repos/golemfactory/golem/stargazers","contributors_url":"https://api.github.com/repos/golemfactory/golem/contributors","subscribers_url":"https://api.github.com/repos/golemfactory/golem/subscribers","subscription_url":"https://api.github.com/repos/golemfactory/golem/subscription","commits_url":"https://api.github.com/repos/golemfactory/golem/commits{/sha}","git_commits_url":"https://api.github.com/repos/golemfactory/golem/git/commits{/sha}","comments_url":"https://api.github.com/repos/golemfactory/golem/comments{/number}","issue_comment_url":"https://api.github.com/repos/golemfactory/golem/issues/comments{/number}","contents_url":"https://api.github.com/repos/golemfactory/golem/contents/{+path}","compare_url":"https://api.github.com/repos/golemfactory/golem/compare/{base}...{head}","merges_url":"https://api.github.com/repos/golemfactory/golem/merges","archive_url":"https://api.github.com/repos/golemfactory/golem/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/golemfactory/golem/downloads","issues_url":"https://api.github.com/repos/golemfactory/golem/issues{/number}","pulls_url":"https://api.github.com/repos/golemfactory/golem/pulls{/number}","milestones_url":"https://api.github.com/repos/golemfactory/golem/milestones{/number}","notifications_url":"https://api.github.com/repos/golemfactory/golem/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/golemfactory/golem/labels{/name}","releases_url":"https://api.github.com/repos/golemfactory/golem/releases{/id}","deployments_url":"https://api.github.com/repos/golemfactory/golem/deployments","created_at":"2015-11-18T17:02:35Z","updated_at":"2018-02-08T12:18:47Z","pushed_at":"2018-02-08T12:41:19Z","git_url":"git://github.com/golemfactory/golem.git","ssh_url":"git@github.com:golemfactory/golem.git","clone_url":"https://github.com/golemfactory/golem.git","svn_url":"https://github.com/golemfactory/golem","homepage":"https://golem.network","size":78438,"stargazers_count":2169,"watchers_count":2169,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":214,"mirror_url":null,"archived":false,"open_issues_count":258,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0"},"forks":214,"open_issues":258,"watchers":2169,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/golemfactory/golem/pulls/2065"},"html":{"href":"https://github.com/golemfactory/golem/pull/2065"},"issue":{"href":"https://api.github.com/repos/golemfactory/golem/issues/2065"},"comments":{"href":"https://api.github.com/repos/golemfactory/golem/issues/2065/comments"},"review_comments":{"href":"https://api.github.com/repos/golemfactory/golem/pulls/2065/comments"},"review_comment":{"href":"https://api.github.com/repos/golemfactory/golem/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/golemfactory/golem/pulls/2065/commits"},"statuses":{"href":"https://api.github.com/repos/golemfactory/golem/statuses/79f71a0596bf8d5e752fc100063086a5baef0f6b"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"jiivan"}}