{"action":"created","comment":{"url":"https://api.github.com/repos/elifesciences/builder/pulls/comments/81565694","pull_request_review_id":2536260,"id":81565694,"diff_hunk":"@@ -122,20 +122,25 @@ def connect_aws_with_stack(stackname, service):\n     pname = project_name_from_stackname(stackname)\n     return connect_aws_with_pname(pname, service)\n \n-# TODO: rename to find_ec2_instances\n-def find_ec2_instance(stackname):\n+def find_ec2_instances(stackname, state=None, node_ids=None):\n     \"returns list of ec2 instances data for a *specific* stackname\"\n     # http://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeInstances.html\n-    filter_by_cluster = {\n+    conn = connect_aws_with_stack(stackname, 'ec2')\n+    return conn.get_only_instances(filters=_all_nodes_filter(stackname, state=state, node_ids=node_ids))\n+\n+def _all_nodes_filter(stackname, state, node_ids):\n+    query = {\n         'tag-key': ['Cluster', 'Name'],\n         'tag-value': [stackname],\n-        'instance-state-name': ['running'],","path":"src/buildercore/core.py","position":16,"original_position":17,"commit_id":"11eac904eb0278db258a564377ca7c1ca86e7f5c","original_commit_id":"11eac904eb0278db258a564377ca7c1ca86e7f5c","user":{"login":"lsh-0","id":2142748,"avatar_url":"https://avatars.githubusercontent.com/u/2142748?v=3","gravatar_id":"","url":"https://api.github.com/users/lsh-0","html_url":"https://github.com/lsh-0","followers_url":"https://api.github.com/users/lsh-0/followers","following_url":"https://api.github.com/users/lsh-0/following{/other_user}","gists_url":"https://api.github.com/users/lsh-0/gists{/gist_id}","starred_url":"https://api.github.com/users/lsh-0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lsh-0/subscriptions","organizations_url":"https://api.github.com/users/lsh-0/orgs","repos_url":"https://api.github.com/users/lsh-0/repos","events_url":"https://api.github.com/users/lsh-0/events{/privacy}","received_events_url":"https://api.github.com/users/lsh-0/received_events","type":"User","site_admin":false},"body":"the default state of 'running' doesn't appear to have been preserved. ","created_at":"2016-10-03T14:49:40Z","updated_at":"2016-10-03T14:49:40Z","html_url":"https://github.com/elifesciences/builder/pull/60#discussion_r81565694","pull_request_url":"https://api.github.com/repos/elifesciences/builder/pulls/60","_links":{"self":{"href":"https://api.github.com/repos/elifesciences/builder/pulls/comments/81565694"},"html":{"href":"https://github.com/elifesciences/builder/pull/60#discussion_r81565694"},"pull_request":{"href":"https://api.github.com/repos/elifesciences/builder/pulls/60"}}},"pull_request":{"url":"https://api.github.com/repos/elifesciences/builder/pulls/60","id":87711969,"html_url":"https://github.com/elifesciences/builder/pull/60","diff_url":"https://github.com/elifesciences/builder/pull/60.diff","patch_url":"https://github.com/elifesciences/builder/pull/60.patch","issue_url":"https://api.github.com/repos/elifesciences/builder/issues/60","number":60,"state":"open","locked":false,"title":"Adds stop, start and stop_if_next_hour_is_imminent tasks","user":{"login":"giorgiosironi","id":160299,"avatar_url":"https://avatars.githubusercontent.com/u/160299?v=3","gravatar_id":"","url":"https://api.github.com/users/giorgiosironi","html_url":"https://github.com/giorgiosironi","followers_url":"https://api.github.com/users/giorgiosironi/followers","following_url":"https://api.github.com/users/giorgiosironi/following{/other_user}","gists_url":"https://api.github.com/users/giorgiosironi/gists{/gist_id}","starred_url":"https://api.github.com/users/giorgiosironi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/giorgiosironi/subscriptions","organizations_url":"https://api.github.com/users/giorgiosironi/orgs","repos_url":"https://api.github.com/users/giorgiosironi/repos","events_url":"https://api.github.com/users/giorgiosironi/events{/privacy}","received_events_url":"https://api.github.com/users/giorgiosironi/received_events","type":"User","site_admin":false},"body":"Sample commands:\r\n`./bldr start:elife-bot--end2end`\r\n`./bldr stop:elife-bot--end2end`\r\n`./bldr stop_if_next_hour_is_imminent:elife-bot--end2end`\r\n\r\nThe first two act on EC2 stop/state commands, bringing each node in the stack to the state `stopping` and then `stopped`; or to the state `pending` and then `running`.\r\n\r\nThe command `stop_if_next_hour_is_imminent` will be used by Alfred in a periodical task to stop nodes that have been running when they have outlived their usefulness. Nodes will be lazily started by builds when needed, but will not run for more than one hour (which is the minimum EC2 billing after a `stopped->running` transition.)\r\n","created_at":"2016-10-03T13:00:01Z","updated_at":"2016-10-03T14:49:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"60e019dac2003cd019de35094acc71829cb57481","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/elifesciences/builder/pulls/60/commits","review_comments_url":"https://api.github.com/repos/elifesciences/builder/pulls/60/comments","review_comment_url":"https://api.github.com/repos/elifesciences/builder/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elifesciences/builder/issues/60/comments","statuses_url":"https://api.github.com/repos/elifesciences/builder/statuses/11eac904eb0278db258a564377ca7c1ca86e7f5c","head":{"label":"elifesciences:stop_start","ref":"stop_start","sha":"11eac904eb0278db258a564377ca7c1ca86e7f5c","user":{"login":"elifesciences","id":1777367,"avatar_url":"https://avatars.githubusercontent.com/u/1777367?v=3","gravatar_id":"","url":"https://api.github.com/users/elifesciences","html_url":"https://github.com/elifesciences","followers_url":"https://api.github.com/users/elifesciences/followers","following_url":"https://api.github.com/users/elifesciences/following{/other_user}","gists_url":"https://api.github.com/users/elifesciences/gists{/gist_id}","starred_url":"https://api.github.com/users/elifesciences/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elifesciences/subscriptions","organizations_url":"https://api.github.com/users/elifesciences/orgs","repos_url":"https://api.github.com/users/elifesciences/repos","events_url":"https://api.github.com/users/elifesciences/events{/privacy}","received_events_url":"https://api.github.com/users/elifesciences/received_events","type":"Organization","site_admin":false},"repo":{"id":56778863,"name":"builder","full_name":"elifesciences/builder","owner":{"login":"elifesciences","id":1777367,"avatar_url":"https://avatars.githubusercontent.com/u/1777367?v=3","gravatar_id":"","url":"https://api.github.com/users/elifesciences","html_url":"https://github.com/elifesciences","followers_url":"https://api.github.com/users/elifesciences/followers","following_url":"https://api.github.com/users/elifesciences/following{/other_user}","gists_url":"https://api.github.com/users/elifesciences/gists{/gist_id}","starred_url":"https://api.github.com/users/elifesciences/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elifesciences/subscriptions","organizations_url":"https://api.github.com/users/elifesciences/orgs","repos_url":"https://api.github.com/users/elifesciences/repos","events_url":"https://api.github.com/users/elifesciences/events{/privacy}","received_events_url":"https://api.github.com/users/elifesciences/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/elifesciences/builder","description":"","fork":false,"url":"https://api.github.com/repos/elifesciences/builder","forks_url":"https://api.github.com/repos/elifesciences/builder/forks","keys_url":"https://api.github.com/repos/elifesciences/builder/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elifesciences/builder/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elifesciences/builder/teams","hooks_url":"https://api.github.com/repos/elifesciences/builder/hooks","issue_events_url":"https://api.github.com/repos/elifesciences/builder/issues/events{/number}","events_url":"https://api.github.com/repos/elifesciences/builder/events","assignees_url":"https://api.github.com/repos/elifesciences/builder/assignees{/user}","branches_url":"https://api.github.com/repos/elifesciences/builder/branches{/branch}","tags_url":"https://api.github.com/repos/elifesciences/builder/tags","blobs_url":"https://api.github.com/repos/elifesciences/builder/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elifesciences/builder/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elifesciences/builder/git/refs{/sha}","trees_url":"https://api.github.com/repos/elifesciences/builder/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elifesciences/builder/statuses/{sha}","languages_url":"https://api.github.com/repos/elifesciences/builder/languages","stargazers_url":"https://api.github.com/repos/elifesciences/builder/stargazers","contributors_url":"https://api.github.com/repos/elifesciences/builder/contributors","subscribers_url":"https://api.github.com/repos/elifesciences/builder/subscribers","subscription_url":"https://api.github.com/repos/elifesciences/builder/subscription","commits_url":"https://api.github.com/repos/elifesciences/builder/commits{/sha}","git_commits_url":"https://api.github.com/repos/elifesciences/builder/git/commits{/sha}","comments_url":"https://api.github.com/repos/elifesciences/builder/comments{/number}","issue_comment_url":"https://api.github.com/repos/elifesciences/builder/issues/comments{/number}","contents_url":"https://api.github.com/repos/elifesciences/builder/contents/{+path}","compare_url":"https://api.github.com/repos/elifesciences/builder/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elifesciences/builder/merges","archive_url":"https://api.github.com/repos/elifesciences/builder/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elifesciences/builder/downloads","issues_url":"https://api.github.com/repos/elifesciences/builder/issues{/number}","pulls_url":"https://api.github.com/repos/elifesciences/builder/pulls{/number}","milestones_url":"https://api.github.com/repos/elifesciences/builder/milestones{/number}","notifications_url":"https://api.github.com/repos/elifesciences/builder/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elifesciences/builder/labels{/name}","releases_url":"https://api.github.com/repos/elifesciences/builder/releases{/id}","deployments_url":"https://api.github.com/repos/elifesciences/builder/deployments","created_at":"2016-04-21T14:08:05Z","updated_at":"2016-07-04T11:43:06Z","pushed_at":"2016-10-03T14:46:19Z","git_url":"git://github.com/elifesciences/builder.git","ssh_url":"git@github.com:elifesciences/builder.git","clone_url":"https://github.com/elifesciences/builder.git","svn_url":"https://github.com/elifesciences/builder","homepage":null,"size":643,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":7,"forks":4,"open_issues":7,"watchers":0,"default_branch":"master"}},"base":{"label":"elifesciences:master","ref":"master","sha":"09a0233844c39b47f6c535de19f17a93144994e0","user":{"login":"elifesciences","id":1777367,"avatar_url":"https://avatars.githubusercontent.com/u/1777367?v=3","gravatar_id":"","url":"https://api.github.com/users/elifesciences","html_url":"https://github.com/elifesciences","followers_url":"https://api.github.com/users/elifesciences/followers","following_url":"https://api.github.com/users/elifesciences/following{/other_user}","gists_url":"https://api.github.com/users/elifesciences/gists{/gist_id}","starred_url":"https://api.github.com/users/elifesciences/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elifesciences/subscriptions","organizations_url":"https://api.github.com/users/elifesciences/orgs","repos_url":"https://api.github.com/users/elifesciences/repos","events_url":"https://api.github.com/users/elifesciences/events{/privacy}","received_events_url":"https://api.github.com/users/elifesciences/received_events","type":"Organization","site_admin":false},"repo":{"id":56778863,"name":"builder","full_name":"elifesciences/builder","owner":{"login":"elifesciences","id":1777367,"avatar_url":"https://avatars.githubusercontent.com/u/1777367?v=3","gravatar_id":"","url":"https://api.github.com/users/elifesciences","html_url":"https://github.com/elifesciences","followers_url":"https://api.github.com/users/elifesciences/followers","following_url":"https://api.github.com/users/elifesciences/following{/other_user}","gists_url":"https://api.github.com/users/elifesciences/gists{/gist_id}","starred_url":"https://api.github.com/users/elifesciences/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elifesciences/subscriptions","organizations_url":"https://api.github.com/users/elifesciences/orgs","repos_url":"https://api.github.com/users/elifesciences/repos","events_url":"https://api.github.com/users/elifesciences/events{/privacy}","received_events_url":"https://api.github.com/users/elifesciences/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/elifesciences/builder","description":"","fork":false,"url":"https://api.github.com/repos/elifesciences/builder","forks_url":"https://api.github.com/repos/elifesciences/builder/forks","keys_url":"https://api.github.com/repos/elifesciences/builder/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elifesciences/builder/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elifesciences/builder/teams","hooks_url":"https://api.github.com/repos/elifesciences/builder/hooks","issue_events_url":"https://api.github.com/repos/elifesciences/builder/issues/events{/number}","events_url":"https://api.github.com/repos/elifesciences/builder/events","assignees_url":"https://api.github.com/repos/elifesciences/builder/assignees{/user}","branches_url":"https://api.github.com/repos/elifesciences/builder/branches{/branch}","tags_url":"https://api.github.com/repos/elifesciences/builder/tags","blobs_url":"https://api.github.com/repos/elifesciences/builder/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elifesciences/builder/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elifesciences/builder/git/refs{/sha}","trees_url":"https://api.github.com/repos/elifesciences/builder/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elifesciences/builder/statuses/{sha}","languages_url":"https://api.github.com/repos/elifesciences/builder/languages","stargazers_url":"https://api.github.com/repos/elifesciences/builder/stargazers","contributors_url":"https://api.github.com/repos/elifesciences/builder/contributors","subscribers_url":"https://api.github.com/repos/elifesciences/builder/subscribers","subscription_url":"https://api.github.com/repos/elifesciences/builder/subscription","commits_url":"https://api.github.com/repos/elifesciences/builder/commits{/sha}","git_commits_url":"https://api.github.com/repos/elifesciences/builder/git/commits{/sha}","comments_url":"https://api.github.com/repos/elifesciences/builder/comments{/number}","issue_comment_url":"https://api.github.com/repos/elifesciences/builder/issues/comments{/number}","contents_url":"https://api.github.com/repos/elifesciences/builder/contents/{+path}","compare_url":"https://api.github.com/repos/elifesciences/builder/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elifesciences/builder/merges","archive_url":"https://api.github.com/repos/elifesciences/builder/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elifesciences/builder/downloads","issues_url":"https://api.github.com/repos/elifesciences/builder/issues{/number}","pulls_url":"https://api.github.com/repos/elifesciences/builder/pulls{/number}","milestones_url":"https://api.github.com/repos/elifesciences/builder/milestones{/number}","notifications_url":"https://api.github.com/repos/elifesciences/builder/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elifesciences/builder/labels{/name}","releases_url":"https://api.github.com/repos/elifesciences/builder/releases{/id}","deployments_url":"https://api.github.com/repos/elifesciences/builder/deployments","created_at":"2016-04-21T14:08:05Z","updated_at":"2016-07-04T11:43:06Z","pushed_at":"2016-10-03T14:46:19Z","git_url":"git://github.com/elifesciences/builder.git","ssh_url":"git@github.com:elifesciences/builder.git","clone_url":"https://github.com/elifesciences/builder.git","svn_url":"https://github.com/elifesciences/builder","homepage":null,"size":643,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":7,"forks":4,"open_issues":7,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/elifesciences/builder/pulls/60"},"html":{"href":"https://github.com/elifesciences/builder/pull/60"},"issue":{"href":"https://api.github.com/repos/elifesciences/builder/issues/60"},"comments":{"href":"https://api.github.com/repos/elifesciences/builder/issues/60/comments"},"review_comments":{"href":"https://api.github.com/repos/elifesciences/builder/pulls/60/comments"},"review_comment":{"href":"https://api.github.com/repos/elifesciences/builder/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elifesciences/builder/pulls/60/commits"},"statuses":{"href":"https://api.github.com/repos/elifesciences/builder/statuses/11eac904eb0278db258a564377ca7c1ca86e7f5c"}}}}
{"actor":{"display_login":"lsh-0"}}