{"action":"created","comment":{"url":"https://api.github.com/repos/Yelp/paasta/pulls/comments/99809406","pull_request_review_id":20492583,"id":99809406,"diff_hunk":"@@ -353,8 +359,20 @@ def autoscale_marathon_instance(marathon_service_config, marathon_tasks, mesos_t\n         **autoscaling_params\n     )\n \n-    new_instance_count = marathon_service_config.limit_instance_count(current_instances + autoscaling_amount)\n+    # Limit downscaling by 30% of current_instances until we find out what is\n+    # going on in such situations\n+    safe_downscaling_threshold = int(current_instances * 0.7)\n+    new_instance_count = max(current_instances + autoscaling_amount, safe_downscaling_threshold)\n+\n+    new_instance_count = marathon_service_config.limit_instance_count(new_instance_count)\n     if new_instance_count != current_instances:\n+        if new_instance_count == safe_downscaling_threshold:\n+            write_to_log(\n+                config=marathon_service_config,\n+                line='Autoscaler clamped: %s' % str(log_utilization_data),","path":"paasta_tools/autoscaling/autoscaling_service_lib.py","position":61,"original_position":61,"commit_id":"3c35a34ba11ace37616b196d8838185b0a54f14d","original_commit_id":"3c35a34ba11ace37616b196d8838185b0a54f14d","user":{"login":"mattmb","id":2462243,"avatar_url":"https://avatars.githubusercontent.com/u/2462243?v=3","gravatar_id":"","url":"https://api.github.com/users/mattmb","html_url":"https://github.com/mattmb","followers_url":"https://api.github.com/users/mattmb/followers","following_url":"https://api.github.com/users/mattmb/following{/other_user}","gists_url":"https://api.github.com/users/mattmb/gists{/gist_id}","starred_url":"https://api.github.com/users/mattmb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattmb/subscriptions","organizations_url":"https://api.github.com/users/mattmb/orgs","repos_url":"https://api.github.com/users/mattmb/repos","events_url":"https://api.github.com/users/mattmb/events{/privacy}","received_events_url":"https://api.github.com/users/mattmb/received_events","type":"User","site_admin":false},"body":"Maybe I'm missing something? But I can't see where this is returned from the metric provider. Isn't it always going to be `{}`?","created_at":"2017-02-07T12:21:05Z","updated_at":"2017-02-07T12:21:19Z","html_url":"https://github.com/Yelp/paasta/pull/1000#discussion_r99809406","pull_request_url":"https://api.github.com/repos/Yelp/paasta/pulls/1000","_links":{"self":{"href":"https://api.github.com/repos/Yelp/paasta/pulls/comments/99809406"},"html":{"href":"https://github.com/Yelp/paasta/pull/1000#discussion_r99809406"},"pull_request":{"href":"https://api.github.com/repos/Yelp/paasta/pulls/1000"}}},"pull_request":{"url":"https://api.github.com/repos/Yelp/paasta/pulls/1000","id":104408410,"html_url":"https://github.com/Yelp/paasta/pull/1000","diff_url":"https://github.com/Yelp/paasta/pull/1000.diff","patch_url":"https://github.com/Yelp/paasta/pull/1000.patch","issue_url":"https://api.github.com/repos/Yelp/paasta/issues/1000","number":1000,"state":"open","locked":false,"title":"Limit downscaling by 30% of current_instances.","user":{"login":"oktopuz","id":1208535,"avatar_url":"https://avatars.githubusercontent.com/u/1208535?v=3","gravatar_id":"","url":"https://api.github.com/users/oktopuz","html_url":"https://github.com/oktopuz","followers_url":"https://api.github.com/users/oktopuz/followers","following_url":"https://api.github.com/users/oktopuz/following{/other_user}","gists_url":"https://api.github.com/users/oktopuz/gists{/gist_id}","starred_url":"https://api.github.com/users/oktopuz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oktopuz/subscriptions","organizations_url":"https://api.github.com/users/oktopuz/orgs","repos_url":"https://api.github.com/users/oktopuz/repos","events_url":"https://api.github.com/users/oktopuz/events{/privacy}","received_events_url":"https://api.github.com/users/oktopuz/received_events","type":"User","site_admin":false},"body":"internal ticket PAASTA-8027\r\n\r\n* Limit how many instances to kill at a time.\r\n* Additional log record when the number of instances changes.\r\n* More tests for autoscale_marathon_instance()","created_at":"2017-02-02T19:38:16Z","updated_at":"2017-02-07T12:21:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"db5f44324fd3dd0956b0375ea234eb3d9976103d","assignee":{"login":"oktopuz","id":1208535,"avatar_url":"https://avatars.githubusercontent.com/u/1208535?v=3","gravatar_id":"","url":"https://api.github.com/users/oktopuz","html_url":"https://github.com/oktopuz","followers_url":"https://api.github.com/users/oktopuz/followers","following_url":"https://api.github.com/users/oktopuz/following{/other_user}","gists_url":"https://api.github.com/users/oktopuz/gists{/gist_id}","starred_url":"https://api.github.com/users/oktopuz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oktopuz/subscriptions","organizations_url":"https://api.github.com/users/oktopuz/orgs","repos_url":"https://api.github.com/users/oktopuz/repos","events_url":"https://api.github.com/users/oktopuz/events{/privacy}","received_events_url":"https://api.github.com/users/oktopuz/received_events","type":"User","site_admin":false},"assignees":[{"login":"oktopuz","id":1208535,"avatar_url":"https://avatars.githubusercontent.com/u/1208535?v=3","gravatar_id":"","url":"https://api.github.com/users/oktopuz","html_url":"https://github.com/oktopuz","followers_url":"https://api.github.com/users/oktopuz/followers","following_url":"https://api.github.com/users/oktopuz/following{/other_user}","gists_url":"https://api.github.com/users/oktopuz/gists{/gist_id}","starred_url":"https://api.github.com/users/oktopuz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oktopuz/subscriptions","organizations_url":"https://api.github.com/users/oktopuz/orgs","repos_url":"https://api.github.com/users/oktopuz/repos","events_url":"https://api.github.com/users/oktopuz/events{/privacy}","received_events_url":"https://api.github.com/users/oktopuz/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/Yelp/paasta/pulls/1000/commits","review_comments_url":"https://api.github.com/repos/Yelp/paasta/pulls/1000/comments","review_comment_url":"https://api.github.com/repos/Yelp/paasta/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Yelp/paasta/issues/1000/comments","statuses_url":"https://api.github.com/repos/Yelp/paasta/statuses/3c35a34ba11ace37616b196d8838185b0a54f14d","head":{"label":"Yelp:PAASTA-8027-limit-downscaling","ref":"PAASTA-8027-limit-downscaling","sha":"3c35a34ba11ace37616b196d8838185b0a54f14d","user":{"login":"Yelp","id":49071,"avatar_url":"https://avatars.githubusercontent.com/u/49071?v=3","gravatar_id":"","url":"https://api.github.com/users/Yelp","html_url":"https://github.com/Yelp","followers_url":"https://api.github.com/users/Yelp/followers","following_url":"https://api.github.com/users/Yelp/following{/other_user}","gists_url":"https://api.github.com/users/Yelp/gists{/gist_id}","starred_url":"https://api.github.com/users/Yelp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yelp/subscriptions","organizations_url":"https://api.github.com/users/Yelp/orgs","repos_url":"https://api.github.com/users/Yelp/repos","events_url":"https://api.github.com/users/Yelp/events{/privacy}","received_events_url":"https://api.github.com/users/Yelp/received_events","type":"Organization","site_admin":false},"repo":{"id":44998824,"name":"paasta","full_name":"Yelp/paasta","owner":{"login":"Yelp","id":49071,"avatar_url":"https://avatars.githubusercontent.com/u/49071?v=3","gravatar_id":"","url":"https://api.github.com/users/Yelp","html_url":"https://github.com/Yelp","followers_url":"https://api.github.com/users/Yelp/followers","following_url":"https://api.github.com/users/Yelp/following{/other_user}","gists_url":"https://api.github.com/users/Yelp/gists{/gist_id}","starred_url":"https://api.github.com/users/Yelp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yelp/subscriptions","organizations_url":"https://api.github.com/users/Yelp/orgs","repos_url":"https://api.github.com/users/Yelp/repos","events_url":"https://api.github.com/users/Yelp/events{/privacy}","received_events_url":"https://api.github.com/users/Yelp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Yelp/paasta","description":"An open, distributed platform as a service","fork":false,"url":"https://api.github.com/repos/Yelp/paasta","forks_url":"https://api.github.com/repos/Yelp/paasta/forks","keys_url":"https://api.github.com/repos/Yelp/paasta/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Yelp/paasta/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Yelp/paasta/teams","hooks_url":"https://api.github.com/repos/Yelp/paasta/hooks","issue_events_url":"https://api.github.com/repos/Yelp/paasta/issues/events{/number}","events_url":"https://api.github.com/repos/Yelp/paasta/events","assignees_url":"https://api.github.com/repos/Yelp/paasta/assignees{/user}","branches_url":"https://api.github.com/repos/Yelp/paasta/branches{/branch}","tags_url":"https://api.github.com/repos/Yelp/paasta/tags","blobs_url":"https://api.github.com/repos/Yelp/paasta/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Yelp/paasta/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Yelp/paasta/git/refs{/sha}","trees_url":"https://api.github.com/repos/Yelp/paasta/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Yelp/paasta/statuses/{sha}","languages_url":"https://api.github.com/repos/Yelp/paasta/languages","stargazers_url":"https://api.github.com/repos/Yelp/paasta/stargazers","contributors_url":"https://api.github.com/repos/Yelp/paasta/contributors","subscribers_url":"https://api.github.com/repos/Yelp/paasta/subscribers","subscription_url":"https://api.github.com/repos/Yelp/paasta/subscription","commits_url":"https://api.github.com/repos/Yelp/paasta/commits{/sha}","git_commits_url":"https://api.github.com/repos/Yelp/paasta/git/commits{/sha}","comments_url":"https://api.github.com/repos/Yelp/paasta/comments{/number}","issue_comment_url":"https://api.github.com/repos/Yelp/paasta/issues/comments{/number}","contents_url":"https://api.github.com/repos/Yelp/paasta/contents/{+path}","compare_url":"https://api.github.com/repos/Yelp/paasta/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Yelp/paasta/merges","archive_url":"https://api.github.com/repos/Yelp/paasta/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Yelp/paasta/downloads","issues_url":"https://api.github.com/repos/Yelp/paasta/issues{/number}","pulls_url":"https://api.github.com/repos/Yelp/paasta/pulls{/number}","milestones_url":"https://api.github.com/repos/Yelp/paasta/milestones{/number}","notifications_url":"https://api.github.com/repos/Yelp/paasta/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Yelp/paasta/labels{/name}","releases_url":"https://api.github.com/repos/Yelp/paasta/releases{/id}","deployments_url":"https://api.github.com/repos/Yelp/paasta/deployments","created_at":"2015-10-26T21:35:53Z","updated_at":"2017-02-06T10:04:27Z","pushed_at":"2017-02-07T01:39:36Z","git_url":"git://github.com/Yelp/paasta.git","ssh_url":"git@github.com:Yelp/paasta.git","clone_url":"https://github.com/Yelp/paasta.git","svn_url":"https://github.com/Yelp/paasta","homepage":"","size":13533,"stargazers_count":972,"watchers_count":972,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":107,"mirror_url":null,"open_issues_count":66,"forks":107,"open_issues":66,"watchers":972,"default_branch":"master"}},"base":{"label":"Yelp:master","ref":"master","sha":"23f52625edd5e0a9615386016007062fd05f2a24","user":{"login":"Yelp","id":49071,"avatar_url":"https://avatars.githubusercontent.com/u/49071?v=3","gravatar_id":"","url":"https://api.github.com/users/Yelp","html_url":"https://github.com/Yelp","followers_url":"https://api.github.com/users/Yelp/followers","following_url":"https://api.github.com/users/Yelp/following{/other_user}","gists_url":"https://api.github.com/users/Yelp/gists{/gist_id}","starred_url":"https://api.github.com/users/Yelp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yelp/subscriptions","organizations_url":"https://api.github.com/users/Yelp/orgs","repos_url":"https://api.github.com/users/Yelp/repos","events_url":"https://api.github.com/users/Yelp/events{/privacy}","received_events_url":"https://api.github.com/users/Yelp/received_events","type":"Organization","site_admin":false},"repo":{"id":44998824,"name":"paasta","full_name":"Yelp/paasta","owner":{"login":"Yelp","id":49071,"avatar_url":"https://avatars.githubusercontent.com/u/49071?v=3","gravatar_id":"","url":"https://api.github.com/users/Yelp","html_url":"https://github.com/Yelp","followers_url":"https://api.github.com/users/Yelp/followers","following_url":"https://api.github.com/users/Yelp/following{/other_user}","gists_url":"https://api.github.com/users/Yelp/gists{/gist_id}","starred_url":"https://api.github.com/users/Yelp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yelp/subscriptions","organizations_url":"https://api.github.com/users/Yelp/orgs","repos_url":"https://api.github.com/users/Yelp/repos","events_url":"https://api.github.com/users/Yelp/events{/privacy}","received_events_url":"https://api.github.com/users/Yelp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Yelp/paasta","description":"An open, distributed platform as a service","fork":false,"url":"https://api.github.com/repos/Yelp/paasta","forks_url":"https://api.github.com/repos/Yelp/paasta/forks","keys_url":"https://api.github.com/repos/Yelp/paasta/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Yelp/paasta/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Yelp/paasta/teams","hooks_url":"https://api.github.com/repos/Yelp/paasta/hooks","issue_events_url":"https://api.github.com/repos/Yelp/paasta/issues/events{/number}","events_url":"https://api.github.com/repos/Yelp/paasta/events","assignees_url":"https://api.github.com/repos/Yelp/paasta/assignees{/user}","branches_url":"https://api.github.com/repos/Yelp/paasta/branches{/branch}","tags_url":"https://api.github.com/repos/Yelp/paasta/tags","blobs_url":"https://api.github.com/repos/Yelp/paasta/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Yelp/paasta/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Yelp/paasta/git/refs{/sha}","trees_url":"https://api.github.com/repos/Yelp/paasta/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Yelp/paasta/statuses/{sha}","languages_url":"https://api.github.com/repos/Yelp/paasta/languages","stargazers_url":"https://api.github.com/repos/Yelp/paasta/stargazers","contributors_url":"https://api.github.com/repos/Yelp/paasta/contributors","subscribers_url":"https://api.github.com/repos/Yelp/paasta/subscribers","subscription_url":"https://api.github.com/repos/Yelp/paasta/subscription","commits_url":"https://api.github.com/repos/Yelp/paasta/commits{/sha}","git_commits_url":"https://api.github.com/repos/Yelp/paasta/git/commits{/sha}","comments_url":"https://api.github.com/repos/Yelp/paasta/comments{/number}","issue_comment_url":"https://api.github.com/repos/Yelp/paasta/issues/comments{/number}","contents_url":"https://api.github.com/repos/Yelp/paasta/contents/{+path}","compare_url":"https://api.github.com/repos/Yelp/paasta/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Yelp/paasta/merges","archive_url":"https://api.github.com/repos/Yelp/paasta/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Yelp/paasta/downloads","issues_url":"https://api.github.com/repos/Yelp/paasta/issues{/number}","pulls_url":"https://api.github.com/repos/Yelp/paasta/pulls{/number}","milestones_url":"https://api.github.com/repos/Yelp/paasta/milestones{/number}","notifications_url":"https://api.github.com/repos/Yelp/paasta/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Yelp/paasta/labels{/name}","releases_url":"https://api.github.com/repos/Yelp/paasta/releases{/id}","deployments_url":"https://api.github.com/repos/Yelp/paasta/deployments","created_at":"2015-10-26T21:35:53Z","updated_at":"2017-02-06T10:04:27Z","pushed_at":"2017-02-07T01:39:36Z","git_url":"git://github.com/Yelp/paasta.git","ssh_url":"git@github.com:Yelp/paasta.git","clone_url":"https://github.com/Yelp/paasta.git","svn_url":"https://github.com/Yelp/paasta","homepage":"","size":13533,"stargazers_count":972,"watchers_count":972,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":107,"mirror_url":null,"open_issues_count":66,"forks":107,"open_issues":66,"watchers":972,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Yelp/paasta/pulls/1000"},"html":{"href":"https://github.com/Yelp/paasta/pull/1000"},"issue":{"href":"https://api.github.com/repos/Yelp/paasta/issues/1000"},"comments":{"href":"https://api.github.com/repos/Yelp/paasta/issues/1000/comments"},"review_comments":{"href":"https://api.github.com/repos/Yelp/paasta/pulls/1000/comments"},"review_comment":{"href":"https://api.github.com/repos/Yelp/paasta/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Yelp/paasta/pulls/1000/commits"},"statuses":{"href":"https://api.github.com/repos/Yelp/paasta/statuses/3c35a34ba11ace37616b196d8838185b0a54f14d"}}}}
{"actor":{"display_login":"mattmb"}}