{"action":"created","comment":{"url":"https://api.github.com/repos/BD2KGenomics/cgcloud/pulls/comments/39917815","id":39917815,"diff_hunk":"@@ -49,6 +49,56 @@ def unpack_singleton( singleton ):\n     except StopIteration:\n         return result\n \n+def mean(listOfNums):\n+    \"\"\"\n+    from http://rosettacode.org/wiki/Standard_deviation#Python\n+    :param listOfNums:\n+    :return: Floating point representation of the average of listOfNums\n+\n+    >>> mean([2,4,4,4,5,5,7,9])\n+    5.0\n+    >>> mean([9,10,11,7,13])\n+    10.0\n+    >>> mean([1,1,10,19,19])\n+    10.0\n+    >>> mean([10,10,10,10,10])\n+    10.0\n+    >>> mean([\"a\",\"b\"])\n+    Traceback (most recent call last):\n+      ...\n+    TypeError: unsupported operand type(s) for /: 'str' and 'float'\n+    >>> mean([])\n+    Traceback (most recent call last):\n+      ...\n+    TypeError: reduce() of empty sequence with no initial value\n+    \"\"\"\n+    return (lambda MyList : reduce(lambda x, y: x + y, MyList) / float(len(MyList)))(listOfNums)\n+\n+def std_dev(listOfNums):\n+    \"\"\"\n+    from http://rosettacode.org/wiki/Standard_deviation#Python\n+    An empty list, or list of non-numbers, will throw a TypeError\n+    :param listOfNums:\n+    :return: Floating point representation of the standard deviation of listOfNums\n+\n+    >>> std_dev([2,4,4,4,5,5,7,9])\n+    2.0\n+    >>> std_dev([9,10,11,7,13])\n+    2.0\n+    >>> std_dev([1,1,10,19,19])\n+    8.049844718999243\n+    >>> std_dev([10,10,10,10,10])\n+    0.0\n+    >>> std_dev([\"a\",\"b\"])\n+    Traceback (most recent call last):\n+      ...\n+    TypeError: unsupported operand type(s) for /: 'str' and 'float'\n+    >>> std_dev([])\n+    Traceback (most recent call last):\n+      ...\n+    TypeError: reduce() of empty sequence with no initial value\n+    \"\"\"\n+    return (lambda MyList : (reduce(lambda x,y : x + y , map(lambda x: (x-mean(MyList))**2 , MyList)) / float(len(MyList)))**.5)(listOfNums)","path":"lib/src/cgcloud/lib/util.py","position":53,"original_position":53,"commit_id":"4697ecda40cc57d7dfb6f55ef0e6b0dc7d5586ca","original_commit_id":"4697ecda40cc57d7dfb6f55ef0e6b0dc7d5586ca","user":{"login":"hannes-ucsc","id":5143256,"avatar_url":"https://avatars.githubusercontent.com/u/5143256?v=3","gravatar_id":"","url":"https://api.github.com/users/hannes-ucsc","html_url":"https://github.com/hannes-ucsc","followers_url":"https://api.github.com/users/hannes-ucsc/followers","following_url":"https://api.github.com/users/hannes-ucsc/following{/other_user}","gists_url":"https://api.github.com/users/hannes-ucsc/gists{/gist_id}","starred_url":"https://api.github.com/users/hannes-ucsc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hannes-ucsc/subscriptions","organizations_url":"https://api.github.com/users/hannes-ucsc/orgs","repos_url":"https://api.github.com/users/hannes-ucsc/repos","events_url":"https://api.github.com/users/hannes-ucsc/events{/privacy}","received_events_url":"https://api.github.com/users/hannes-ucsc/received_events","type":"User","site_admin":false},"body":"too long and incomprehensible. Also, there is sum()","created_at":"2015-09-19T08:21:19Z","updated_at":"2015-09-19T08:21:19Z","html_url":"https://github.com/BD2KGenomics/cgcloud/pull/33#discussion_r39917815","pull_request_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/pulls/33","_links":{"self":{"href":"https://api.github.com/repos/BD2KGenomics/cgcloud/pulls/comments/39917815"},"html":{"href":"https://github.com/BD2KGenomics/cgcloud/pull/33#discussion_r39917815"},"pull_request":{"href":"https://api.github.com/repos/BD2KGenomics/cgcloud/pulls/33"}}},"pull_request":{"url":"https://api.github.com/repos/BD2KGenomics/cgcloud/pulls/33","id":38402135,"html_url":"https://github.com/BD2KGenomics/cgcloud/pull/33","diff_url":"https://github.com/BD2KGenomics/cgcloud/pull/33.diff","patch_url":"https://github.com/BD2KGenomics/cgcloud/pull/33.patch","issue_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/issues/33","number":33,"state":"closed","locked":false,"title":"Add spot market support","user":{"login":"cket","id":10136261,"avatar_url":"https://avatars.githubusercontent.com/u/10136261?v=3","gravatar_id":"","url":"https://api.github.com/users/cket","html_url":"https://github.com/cket","followers_url":"https://api.github.com/users/cket/followers","following_url":"https://api.github.com/users/cket/following{/other_user}","gists_url":"https://api.github.com/users/cket/gists{/gist_id}","starred_url":"https://api.github.com/users/cket/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cket/subscriptions","organizations_url":"https://api.github.com/users/cket/orgs","repos_url":"https://api.github.com/users/cket/repos","events_url":"https://api.github.com/users/cket/events{/privacy}","received_events_url":"https://api.github.com/users/cket/received_events","type":"User","site_admin":false},"body":"Added flag --spot-bid to Creation Command class. Makes sure the bid is reasonable by averaging the last week's spot price for the requested instance, and insuring that the bid less than double that average. Checks that the instance you request is available on the spot market. Works with any command that inherits from CreationCommand including create, recreate, and create-mesos-cluster. ","created_at":"2015-06-24T02:26:14Z","updated_at":"2015-09-19T08:21:19Z","closed_at":"2015-09-19T06:56:49Z","merged_at":"2015-09-19T06:56:49Z","merge_commit_sha":"4334f1cd4256032739f01bb1b12815518bceffbd","assignee":{"login":"cket","id":10136261,"avatar_url":"https://avatars.githubusercontent.com/u/10136261?v=3","gravatar_id":"","url":"https://api.github.com/users/cket","html_url":"https://github.com/cket","followers_url":"https://api.github.com/users/cket/followers","following_url":"https://api.github.com/users/cket/following{/other_user}","gists_url":"https://api.github.com/users/cket/gists{/gist_id}","starred_url":"https://api.github.com/users/cket/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cket/subscriptions","organizations_url":"https://api.github.com/users/cket/orgs","repos_url":"https://api.github.com/users/cket/repos","events_url":"https://api.github.com/users/cket/events{/privacy}","received_events_url":"https://api.github.com/users/cket/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/pulls/33/commits","review_comments_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/pulls/33/comments","review_comment_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/pulls/comments{/number}","comments_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/issues/33/comments","statuses_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/statuses/4697ecda40cc57d7dfb6f55ef0e6b0dc7d5586ca","head":{"label":"BD2KGenomics:spot_market_support","ref":"spot_market_support","sha":"4697ecda40cc57d7dfb6f55ef0e6b0dc7d5586ca","user":{"login":"BD2KGenomics","id":8701293,"avatar_url":"https://avatars.githubusercontent.com/u/8701293?v=3","gravatar_id":"","url":"https://api.github.com/users/BD2KGenomics","html_url":"https://github.com/BD2KGenomics","followers_url":"https://api.github.com/users/BD2KGenomics/followers","following_url":"https://api.github.com/users/BD2KGenomics/following{/other_user}","gists_url":"https://api.github.com/users/BD2KGenomics/gists{/gist_id}","starred_url":"https://api.github.com/users/BD2KGenomics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BD2KGenomics/subscriptions","organizations_url":"https://api.github.com/users/BD2KGenomics/orgs","repos_url":"https://api.github.com/users/BD2KGenomics/repos","events_url":"https://api.github.com/users/BD2KGenomics/events{/privacy}","received_events_url":"https://api.github.com/users/BD2KGenomics/received_events","type":"Organization","site_admin":false},"repo":{"id":36099221,"name":"cgcloud","full_name":"BD2KGenomics/cgcloud","owner":{"login":"BD2KGenomics","id":8701293,"avatar_url":"https://avatars.githubusercontent.com/u/8701293?v=3","gravatar_id":"","url":"https://api.github.com/users/BD2KGenomics","html_url":"https://github.com/BD2KGenomics","followers_url":"https://api.github.com/users/BD2KGenomics/followers","following_url":"https://api.github.com/users/BD2KGenomics/following{/other_user}","gists_url":"https://api.github.com/users/BD2KGenomics/gists{/gist_id}","starred_url":"https://api.github.com/users/BD2KGenomics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BD2KGenomics/subscriptions","organizations_url":"https://api.github.com/users/BD2KGenomics/orgs","repos_url":"https://api.github.com/users/BD2KGenomics/repos","events_url":"https://api.github.com/users/BD2KGenomics/events{/privacy}","received_events_url":"https://api.github.com/users/BD2KGenomics/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/BD2KGenomics/cgcloud","description":"Image and VM management for Jenkins, Spark and Mesos clusters in EC2","fork":false,"url":"https://api.github.com/repos/BD2KGenomics/cgcloud","forks_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/forks","keys_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/teams","hooks_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/hooks","issue_events_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/issues/events{/number}","events_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/events","assignees_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/assignees{/user}","branches_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/branches{/branch}","tags_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/tags","blobs_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/git/refs{/sha}","trees_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/statuses/{sha}","languages_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/languages","stargazers_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/stargazers","contributors_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/contributors","subscribers_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/subscribers","subscription_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/subscription","commits_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/commits{/sha}","git_commits_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/git/commits{/sha}","comments_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/comments{/number}","issue_comment_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/issues/comments{/number}","contents_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/contents/{+path}","compare_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/merges","archive_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/downloads","issues_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/issues{/number}","pulls_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/pulls{/number}","milestones_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/milestones{/number}","notifications_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/labels{/name}","releases_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/releases{/id}","created_at":"2015-05-22T23:17:45Z","updated_at":"2015-07-27T02:44:30Z","pushed_at":"2015-09-19T06:56:53Z","git_url":"git://github.com/BD2KGenomics/cgcloud.git","ssh_url":"git@github.com:BD2KGenomics/cgcloud.git","clone_url":"https://github.com/BD2KGenomics/cgcloud.git","svn_url":"https://github.com/BD2KGenomics/cgcloud","homepage":null,"size":2079,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":29,"forks":1,"open_issues":29,"watchers":1,"default_branch":"master"}},"base":{"label":"BD2KGenomics:master","ref":"master","sha":"f46cc22a93012c16c04de1f7f1d82993dead2929","user":{"login":"BD2KGenomics","id":8701293,"avatar_url":"https://avatars.githubusercontent.com/u/8701293?v=3","gravatar_id":"","url":"https://api.github.com/users/BD2KGenomics","html_url":"https://github.com/BD2KGenomics","followers_url":"https://api.github.com/users/BD2KGenomics/followers","following_url":"https://api.github.com/users/BD2KGenomics/following{/other_user}","gists_url":"https://api.github.com/users/BD2KGenomics/gists{/gist_id}","starred_url":"https://api.github.com/users/BD2KGenomics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BD2KGenomics/subscriptions","organizations_url":"https://api.github.com/users/BD2KGenomics/orgs","repos_url":"https://api.github.com/users/BD2KGenomics/repos","events_url":"https://api.github.com/users/BD2KGenomics/events{/privacy}","received_events_url":"https://api.github.com/users/BD2KGenomics/received_events","type":"Organization","site_admin":false},"repo":{"id":36099221,"name":"cgcloud","full_name":"BD2KGenomics/cgcloud","owner":{"login":"BD2KGenomics","id":8701293,"avatar_url":"https://avatars.githubusercontent.com/u/8701293?v=3","gravatar_id":"","url":"https://api.github.com/users/BD2KGenomics","html_url":"https://github.com/BD2KGenomics","followers_url":"https://api.github.com/users/BD2KGenomics/followers","following_url":"https://api.github.com/users/BD2KGenomics/following{/other_user}","gists_url":"https://api.github.com/users/BD2KGenomics/gists{/gist_id}","starred_url":"https://api.github.com/users/BD2KGenomics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BD2KGenomics/subscriptions","organizations_url":"https://api.github.com/users/BD2KGenomics/orgs","repos_url":"https://api.github.com/users/BD2KGenomics/repos","events_url":"https://api.github.com/users/BD2KGenomics/events{/privacy}","received_events_url":"https://api.github.com/users/BD2KGenomics/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/BD2KGenomics/cgcloud","description":"Image and VM management for Jenkins, Spark and Mesos clusters in EC2","fork":false,"url":"https://api.github.com/repos/BD2KGenomics/cgcloud","forks_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/forks","keys_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/teams","hooks_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/hooks","issue_events_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/issues/events{/number}","events_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/events","assignees_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/assignees{/user}","branches_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/branches{/branch}","tags_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/tags","blobs_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/git/refs{/sha}","trees_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/statuses/{sha}","languages_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/languages","stargazers_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/stargazers","contributors_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/contributors","subscribers_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/subscribers","subscription_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/subscription","commits_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/commits{/sha}","git_commits_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/git/commits{/sha}","comments_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/comments{/number}","issue_comment_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/issues/comments{/number}","contents_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/contents/{+path}","compare_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/merges","archive_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/downloads","issues_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/issues{/number}","pulls_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/pulls{/number}","milestones_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/milestones{/number}","notifications_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/labels{/name}","releases_url":"https://api.github.com/repos/BD2KGenomics/cgcloud/releases{/id}","created_at":"2015-05-22T23:17:45Z","updated_at":"2015-07-27T02:44:30Z","pushed_at":"2015-09-19T06:56:53Z","git_url":"git://github.com/BD2KGenomics/cgcloud.git","ssh_url":"git@github.com:BD2KGenomics/cgcloud.git","clone_url":"https://github.com/BD2KGenomics/cgcloud.git","svn_url":"https://github.com/BD2KGenomics/cgcloud","homepage":null,"size":2079,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":29,"forks":1,"open_issues":29,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/BD2KGenomics/cgcloud/pulls/33"},"html":{"href":"https://github.com/BD2KGenomics/cgcloud/pull/33"},"issue":{"href":"https://api.github.com/repos/BD2KGenomics/cgcloud/issues/33"},"comments":{"href":"https://api.github.com/repos/BD2KGenomics/cgcloud/issues/33/comments"},"review_comments":{"href":"https://api.github.com/repos/BD2KGenomics/cgcloud/pulls/33/comments"},"review_comment":{"href":"https://api.github.com/repos/BD2KGenomics/cgcloud/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/BD2KGenomics/cgcloud/pulls/33/commits"},"statuses":{"href":"https://api.github.com/repos/BD2KGenomics/cgcloud/statuses/4697ecda40cc57d7dfb6f55ef0e6b0dc7d5586ca"}}}}