{"action":"created","comment":{"url":"https://api.github.com/repos/yandex/mastermind/pulls/comments/79412852","id":79412852,"diff_hunk":"@@ -0,0 +1,143 @@\n+import logging\n+import os.path\n+\n+from error import JobBrokenError\n+from infrastructure import infrastructure\n+from job import Job\n+from job_types import JobTypes\n+from tasks import NodeStopTask, MinionCmdTask, HistoryRemoveNodeTask\n+import storage\n+\n+\n+logger = logging.getLogger('mm.jobs')\n+\n+\n+class BackendCleanupJob(Job):\n+\n+    GROUP_FILE_PATH = Job.BACKEND_COMMANDS_CFG.get('group_file')\n+    BACKEND_CLEANUP_GROUP_FILE_DIR_RENAME = Job.BACKEND_COMMANDS_CFG.get(\n+        'backend_cleanup_group_file_dir_rename'\n+    )\n+\n+    PARAMS = ('group', 'resources')\n+\n+    def __init__(self, **kwargs):\n+        super(BackendCleanupJob, self).__init__(**kwargs)\n+        self.type = JobTypes.TYPE_BACKEND_CLEANUP_JOB\n+\n+    def _set_resources(self):\n+        self.resources = {}\n+\n+    def create_tasks(self, processor):\n+        group = storage.groups[self.group]\n+\n+        if len(group.node_backends) == 1:\n+            node_backend = group.node_backends[0]\n+        else:\n+            raise JobBrokenError(\n+                'Group {} has {} node backends, currently '\n+                'only groups with 1 node backend can be used'.format(\n+                    group.group_id, len(group.node_backends)))\n+\n+        tasks = []\n+\n+        tasks.append(\n+            self._stop_node_backend_task(group, node_backend)\n+        )\n+\n+        tasks.append(\n+            self._reconfigure_node_task(node_backend)\n+        )\n+\n+        tasks.append(\n+            self._remove_node_backend_from_history(node_backend)","path":"src/cocaine-app/jobs/backend_cleanup.py","position":53,"original_position":53,"commit_id":"9d5fd30bf12bc661ab18b44accebb3cbeb1b2726","original_commit_id":"9d5fd30bf12bc661ab18b44accebb3cbeb1b2726","user":{"login":"nobodyisme","id":432845,"avatar_url":"https://avatars.githubusercontent.com/u/432845?v=3","gravatar_id":"","url":"https://api.github.com/users/nobodyisme","html_url":"https://github.com/nobodyisme","followers_url":"https://api.github.com/users/nobodyisme/followers","following_url":"https://api.github.com/users/nobodyisme/following{/other_user}","gists_url":"https://api.github.com/users/nobodyisme/gists{/gist_id}","starred_url":"https://api.github.com/users/nobodyisme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nobodyisme/subscriptions","organizations_url":"https://api.github.com/users/nobodyisme/orgs","repos_url":"https://api.github.com/users/nobodyisme/repos","events_url":"https://api.github.com/users/nobodyisme/events{/privacy}","received_events_url":"https://api.github.com/users/nobodyisme/received_events","type":"User","site_admin":false},"body":"Тут забыл первым параметром передать `group`.","created_at":"2016-09-19T15:08:09Z","updated_at":"2016-09-19T15:08:09Z","html_url":"https://github.com/yandex/mastermind/pull/234#discussion_r79412852","pull_request_url":"https://api.github.com/repos/yandex/mastermind/pulls/234","_links":{"self":{"href":"https://api.github.com/repos/yandex/mastermind/pulls/comments/79412852"},"html":{"href":"https://github.com/yandex/mastermind/pull/234#discussion_r79412852"},"pull_request":{"href":"https://api.github.com/repos/yandex/mastermind/pulls/234"}}},"pull_request":{"url":"https://api.github.com/repos/yandex/mastermind/pulls/234","id":84314540,"html_url":"https://github.com/yandex/mastermind/pull/234","diff_url":"https://github.com/yandex/mastermind/pull/234.diff","patch_url":"https://github.com/yandex/mastermind/pull/234.patch","issue_url":"https://api.github.com/repos/yandex/mastermind/issues/234","number":234,"state":"open","locked":false,"title":"Restore-path: use backend cleanup job","user":{"login":"Kanst","id":776553,"avatar_url":"https://avatars.githubusercontent.com/u/776553?v=3","gravatar_id":"","url":"https://api.github.com/users/Kanst","html_url":"https://github.com/Kanst","followers_url":"https://api.github.com/users/Kanst/followers","following_url":"https://api.github.com/users/Kanst/following{/other_user}","gists_url":"https://api.github.com/users/Kanst/gists{/gist_id}","starred_url":"https://api.github.com/users/Kanst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kanst/subscriptions","organizations_url":"https://api.github.com/users/Kanst/orgs","repos_url":"https://api.github.com/users/Kanst/repos","events_url":"https://api.github.com/users/Kanst/events{/privacy}","received_events_url":"https://api.github.com/users/Kanst/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-09-07T14:48:45Z","updated_at":"2016-09-19T15:08:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"512efdde8f08b853d25ba30120d43a33a9f7bb49","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/yandex/mastermind/pulls/234/commits","review_comments_url":"https://api.github.com/repos/yandex/mastermind/pulls/234/comments","review_comment_url":"https://api.github.com/repos/yandex/mastermind/pulls/comments{/number}","comments_url":"https://api.github.com/repos/yandex/mastermind/issues/234/comments","statuses_url":"https://api.github.com/repos/yandex/mastermind/statuses/9d5fd30bf12bc661ab18b44accebb3cbeb1b2726","head":{"label":"Kanst:kanst9","ref":"kanst9","sha":"9d5fd30bf12bc661ab18b44accebb3cbeb1b2726","user":{"login":"Kanst","id":776553,"avatar_url":"https://avatars.githubusercontent.com/u/776553?v=3","gravatar_id":"","url":"https://api.github.com/users/Kanst","html_url":"https://github.com/Kanst","followers_url":"https://api.github.com/users/Kanst/followers","following_url":"https://api.github.com/users/Kanst/following{/other_user}","gists_url":"https://api.github.com/users/Kanst/gists{/gist_id}","starred_url":"https://api.github.com/users/Kanst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kanst/subscriptions","organizations_url":"https://api.github.com/users/Kanst/orgs","repos_url":"https://api.github.com/users/Kanst/repos","events_url":"https://api.github.com/users/Kanst/events{/privacy}","received_events_url":"https://api.github.com/users/Kanst/received_events","type":"User","site_admin":false},"repo":{"id":66921213,"name":"mastermind","full_name":"Kanst/mastermind","owner":{"login":"Kanst","id":776553,"avatar_url":"https://avatars.githubusercontent.com/u/776553?v=3","gravatar_id":"","url":"https://api.github.com/users/Kanst","html_url":"https://github.com/Kanst","followers_url":"https://api.github.com/users/Kanst/followers","following_url":"https://api.github.com/users/Kanst/following{/other_user}","gists_url":"https://api.github.com/users/Kanst/gists{/gist_id}","starred_url":"https://api.github.com/users/Kanst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kanst/subscriptions","organizations_url":"https://api.github.com/users/Kanst/orgs","repos_url":"https://api.github.com/users/Kanst/repos","events_url":"https://api.github.com/users/Kanst/events{/privacy}","received_events_url":"https://api.github.com/users/Kanst/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Kanst/mastermind","description":"Smart control for a big storage","fork":true,"url":"https://api.github.com/repos/Kanst/mastermind","forks_url":"https://api.github.com/repos/Kanst/mastermind/forks","keys_url":"https://api.github.com/repos/Kanst/mastermind/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Kanst/mastermind/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Kanst/mastermind/teams","hooks_url":"https://api.github.com/repos/Kanst/mastermind/hooks","issue_events_url":"https://api.github.com/repos/Kanst/mastermind/issues/events{/number}","events_url":"https://api.github.com/repos/Kanst/mastermind/events","assignees_url":"https://api.github.com/repos/Kanst/mastermind/assignees{/user}","branches_url":"https://api.github.com/repos/Kanst/mastermind/branches{/branch}","tags_url":"https://api.github.com/repos/Kanst/mastermind/tags","blobs_url":"https://api.github.com/repos/Kanst/mastermind/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Kanst/mastermind/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Kanst/mastermind/git/refs{/sha}","trees_url":"https://api.github.com/repos/Kanst/mastermind/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Kanst/mastermind/statuses/{sha}","languages_url":"https://api.github.com/repos/Kanst/mastermind/languages","stargazers_url":"https://api.github.com/repos/Kanst/mastermind/stargazers","contributors_url":"https://api.github.com/repos/Kanst/mastermind/contributors","subscribers_url":"https://api.github.com/repos/Kanst/mastermind/subscribers","subscription_url":"https://api.github.com/repos/Kanst/mastermind/subscription","commits_url":"https://api.github.com/repos/Kanst/mastermind/commits{/sha}","git_commits_url":"https://api.github.com/repos/Kanst/mastermind/git/commits{/sha}","comments_url":"https://api.github.com/repos/Kanst/mastermind/comments{/number}","issue_comment_url":"https://api.github.com/repos/Kanst/mastermind/issues/comments{/number}","contents_url":"https://api.github.com/repos/Kanst/mastermind/contents/{+path}","compare_url":"https://api.github.com/repos/Kanst/mastermind/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Kanst/mastermind/merges","archive_url":"https://api.github.com/repos/Kanst/mastermind/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Kanst/mastermind/downloads","issues_url":"https://api.github.com/repos/Kanst/mastermind/issues{/number}","pulls_url":"https://api.github.com/repos/Kanst/mastermind/pulls{/number}","milestones_url":"https://api.github.com/repos/Kanst/mastermind/milestones{/number}","notifications_url":"https://api.github.com/repos/Kanst/mastermind/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Kanst/mastermind/labels{/name}","releases_url":"https://api.github.com/repos/Kanst/mastermind/releases{/id}","deployments_url":"https://api.github.com/repos/Kanst/mastermind/deployments","created_at":"2016-08-30T08:21:20Z","updated_at":"2016-08-30T08:21:23Z","pushed_at":"2016-09-19T15:04:38Z","git_url":"git://github.com/Kanst/mastermind.git","ssh_url":"git@github.com:Kanst/mastermind.git","clone_url":"https://github.com/Kanst/mastermind.git","svn_url":"https://github.com/Kanst/mastermind","homepage":"","size":4576,"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":"yandex:release-2.28","ref":"release-2.28","sha":"5bf7dfa6d8cc7dd9f5080815f4dcd6f737304231","user":{"login":"yandex","id":7409213,"avatar_url":"https://avatars.githubusercontent.com/u/7409213?v=3","gravatar_id":"","url":"https://api.github.com/users/yandex","html_url":"https://github.com/yandex","followers_url":"https://api.github.com/users/yandex/followers","following_url":"https://api.github.com/users/yandex/following{/other_user}","gists_url":"https://api.github.com/users/yandex/gists{/gist_id}","starred_url":"https://api.github.com/users/yandex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yandex/subscriptions","organizations_url":"https://api.github.com/users/yandex/orgs","repos_url":"https://api.github.com/users/yandex/repos","events_url":"https://api.github.com/users/yandex/events{/privacy}","received_events_url":"https://api.github.com/users/yandex/received_events","type":"Organization","site_admin":false},"repo":{"id":23435885,"name":"mastermind","full_name":"yandex/mastermind","owner":{"login":"yandex","id":7409213,"avatar_url":"https://avatars.githubusercontent.com/u/7409213?v=3","gravatar_id":"","url":"https://api.github.com/users/yandex","html_url":"https://github.com/yandex","followers_url":"https://api.github.com/users/yandex/followers","following_url":"https://api.github.com/users/yandex/following{/other_user}","gists_url":"https://api.github.com/users/yandex/gists{/gist_id}","starred_url":"https://api.github.com/users/yandex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yandex/subscriptions","organizations_url":"https://api.github.com/users/yandex/orgs","repos_url":"https://api.github.com/users/yandex/repos","events_url":"https://api.github.com/users/yandex/events{/privacy}","received_events_url":"https://api.github.com/users/yandex/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/yandex/mastermind","description":"Smart control for a big storage","fork":false,"url":"https://api.github.com/repos/yandex/mastermind","forks_url":"https://api.github.com/repos/yandex/mastermind/forks","keys_url":"https://api.github.com/repos/yandex/mastermind/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yandex/mastermind/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yandex/mastermind/teams","hooks_url":"https://api.github.com/repos/yandex/mastermind/hooks","issue_events_url":"https://api.github.com/repos/yandex/mastermind/issues/events{/number}","events_url":"https://api.github.com/repos/yandex/mastermind/events","assignees_url":"https://api.github.com/repos/yandex/mastermind/assignees{/user}","branches_url":"https://api.github.com/repos/yandex/mastermind/branches{/branch}","tags_url":"https://api.github.com/repos/yandex/mastermind/tags","blobs_url":"https://api.github.com/repos/yandex/mastermind/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yandex/mastermind/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yandex/mastermind/git/refs{/sha}","trees_url":"https://api.github.com/repos/yandex/mastermind/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yandex/mastermind/statuses/{sha}","languages_url":"https://api.github.com/repos/yandex/mastermind/languages","stargazers_url":"https://api.github.com/repos/yandex/mastermind/stargazers","contributors_url":"https://api.github.com/repos/yandex/mastermind/contributors","subscribers_url":"https://api.github.com/repos/yandex/mastermind/subscribers","subscription_url":"https://api.github.com/repos/yandex/mastermind/subscription","commits_url":"https://api.github.com/repos/yandex/mastermind/commits{/sha}","git_commits_url":"https://api.github.com/repos/yandex/mastermind/git/commits{/sha}","comments_url":"https://api.github.com/repos/yandex/mastermind/comments{/number}","issue_comment_url":"https://api.github.com/repos/yandex/mastermind/issues/comments{/number}","contents_url":"https://api.github.com/repos/yandex/mastermind/contents/{+path}","compare_url":"https://api.github.com/repos/yandex/mastermind/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yandex/mastermind/merges","archive_url":"https://api.github.com/repos/yandex/mastermind/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yandex/mastermind/downloads","issues_url":"https://api.github.com/repos/yandex/mastermind/issues{/number}","pulls_url":"https://api.github.com/repos/yandex/mastermind/pulls{/number}","milestones_url":"https://api.github.com/repos/yandex/mastermind/milestones{/number}","notifications_url":"https://api.github.com/repos/yandex/mastermind/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yandex/mastermind/labels{/name}","releases_url":"https://api.github.com/repos/yandex/mastermind/releases{/id}","deployments_url":"https://api.github.com/repos/yandex/mastermind/deployments","created_at":"2014-08-28T16:57:05Z","updated_at":"2016-09-13T17:05:22Z","pushed_at":"2016-09-19T15:04:38Z","git_url":"git://github.com/yandex/mastermind.git","ssh_url":"git@github.com:yandex/mastermind.git","clone_url":"https://github.com/yandex/mastermind.git","svn_url":"https://github.com/yandex/mastermind","homepage":"","size":7627,"stargazers_count":9,"watchers_count":9,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":10,"mirror_url":null,"open_issues_count":25,"forks":10,"open_issues":25,"watchers":9,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/yandex/mastermind/pulls/234"},"html":{"href":"https://github.com/yandex/mastermind/pull/234"},"issue":{"href":"https://api.github.com/repos/yandex/mastermind/issues/234"},"comments":{"href":"https://api.github.com/repos/yandex/mastermind/issues/234/comments"},"review_comments":{"href":"https://api.github.com/repos/yandex/mastermind/pulls/234/comments"},"review_comment":{"href":"https://api.github.com/repos/yandex/mastermind/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/yandex/mastermind/pulls/234/commits"},"statuses":{"href":"https://api.github.com/repos/yandex/mastermind/statuses/9d5fd30bf12bc661ab18b44accebb3cbeb1b2726"}}}}
{"actor":{"display_login":"nobodyisme"}}