{"action":"created","comment":{"url":"https://api.github.com/repos/codalab/codalab-cli/pulls/comments/48200275","id":48200275,"diff_hunk":"@@ -0,0 +1,37 @@\n+\"\"\"\n+docker_util.py\n+\n+Utility class wrapping the docker executable\n+\"\"\"\n+from argcomplete import warn\n+import re\n+from subprocess import Popen, PIPE\n+\n+\n+class Docker(object):\n+    \"\"\"\n+    Wrapper class. Various class methods defined in here serve as wrappers for functionality that calls out to\n+    the `docker` binary installed on the host.\n+    \"\"\"\n+\n+    \"\"\"\n+    Compiled regular expression to parse the stdout of `docker search` calls.\n+\n+    This captures the beginning of the line up until the first whitespace character, i.e.\n+    the first column of the output, corresponding to the image tag.\n+    \"\"\"\n+    DOCKER_SEARCH_TAG_REGEX = re.compile(r'^(?P<tag>\\S+)\\s+')\n+\n+    @classmethod\n+    def search(cls, keyword, failure_cb=None):\n+        \"\"\"\n+        Performs `docker search <term>`. Returns tuple of image tags matching the search term.","path":"codalab/lib/docker_util.py","position":28,"original_position":28,"commit_id":"3cd98e9a4c45df2ca34670b5dcb7043e476687fe","original_commit_id":"3cd98e9a4c45df2ca34670b5dcb7043e476687fe","user":{"login":"percyliang","id":435384,"avatar_url":"https://avatars.githubusercontent.com/u/435384?v=3","gravatar_id":"","url":"https://api.github.com/users/percyliang","html_url":"https://github.com/percyliang","followers_url":"https://api.github.com/users/percyliang/followers","following_url":"https://api.github.com/users/percyliang/following{/other_user}","gists_url":"https://api.github.com/users/percyliang/gists{/gist_id}","starred_url":"https://api.github.com/users/percyliang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/percyliang/subscriptions","organizations_url":"https://api.github.com/users/percyliang/orgs","repos_url":"https://api.github.com/users/percyliang/repos","events_url":"https://api.github.com/users/percyliang/events{/privacy}","received_events_url":"https://api.github.com/users/percyliang/received_events","type":"User","site_admin":false},"body":"term => keyword","created_at":"2015-12-21T22:29:15Z","updated_at":"2015-12-21T22:29:15Z","html_url":"https://github.com/codalab/codalab-cli/pull/290#discussion_r48200275","pull_request_url":"https://api.github.com/repos/codalab/codalab-cli/pulls/290","_links":{"self":{"href":"https://api.github.com/repos/codalab/codalab-cli/pulls/comments/48200275"},"html":{"href":"https://github.com/codalab/codalab-cli/pull/290#discussion_r48200275"},"pull_request":{"href":"https://api.github.com/repos/codalab/codalab-cli/pulls/290"}}},"pull_request":{"url":"https://api.github.com/repos/codalab/codalab-cli/pulls/290","id":54218019,"html_url":"https://github.com/codalab/codalab-cli/pull/290","diff_url":"https://github.com/codalab/codalab-cli/pull/290.diff","patch_url":"https://github.com/codalab/codalab-cli/pull/290.patch","issue_url":"https://api.github.com/repos/codalab/codalab-cli/issues/290","number":290,"state":"open","locked":false,"title":"#264: Docker completion","user":{"login":"andreweduffy","id":332583,"avatar_url":"https://avatars.githubusercontent.com/u/332583?v=3","gravatar_id":"","url":"https://api.github.com/users/andreweduffy","html_url":"https://github.com/andreweduffy","followers_url":"https://api.github.com/users/andreweduffy/followers","following_url":"https://api.github.com/users/andreweduffy/following{/other_user}","gists_url":"https://api.github.com/users/andreweduffy/gists{/gist_id}","starred_url":"https://api.github.com/users/andreweduffy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andreweduffy/subscriptions","organizations_url":"https://api.github.com/users/andreweduffy/orgs","repos_url":"https://api.github.com/users/andreweduffy/repos","events_url":"https://api.github.com/users/andreweduffy/events{/privacy}","received_events_url":"https://api.github.com/users/andreweduffy/received_events","type":"User","site_admin":false},"body":"Implements #264 \r\n\r\n**NOTE**: Upfront, should say that this doesn't currently filter images that start with `prefix`, which I actually think might be helpful because you can just type ex. `python` and see all completions that include the prefix. Is a departure from the current behavior with the static list though.\r\n\r\nThings that could use review:\r\n\r\n* **import-in-function-body syntax**: not sure if it's necessary but Popen isn't used anywhere else in completers so I figured it would avoid misleading people by placing it at the top. Could be moved.\r\n* **General strategy of wrapping calls to the docker binary as opposed to using the Docker API**: I tried using docker-py, but there were some complications with SSL that after pouring ~1 hour in didn't get me anywhere. If anyone has a strong opinion we could discuss this, but it seems like using the Remote API might be a little more difficult than it's worth, and relying on the `docker` binary being installed on each worker might be the better route.\r\n\r\nAll comments welcome!","created_at":"2015-12-21T03:38:01Z","updated_at":"2015-12-21T22:29:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ad2a85954c379f2d67e4b03758ebcd3312c34419","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/codalab/codalab-cli/pulls/290/commits","review_comments_url":"https://api.github.com/repos/codalab/codalab-cli/pulls/290/comments","review_comment_url":"https://api.github.com/repos/codalab/codalab-cli/pulls/comments{/number}","comments_url":"https://api.github.com/repos/codalab/codalab-cli/issues/290/comments","statuses_url":"https://api.github.com/repos/codalab/codalab-cli/statuses/3cd98e9a4c45df2ca34670b5dcb7043e476687fe","head":{"label":"andreweduffy:docker-completion","ref":"docker-completion","sha":"3cd98e9a4c45df2ca34670b5dcb7043e476687fe","user":{"login":"andreweduffy","id":332583,"avatar_url":"https://avatars.githubusercontent.com/u/332583?v=3","gravatar_id":"","url":"https://api.github.com/users/andreweduffy","html_url":"https://github.com/andreweduffy","followers_url":"https://api.github.com/users/andreweduffy/followers","following_url":"https://api.github.com/users/andreweduffy/following{/other_user}","gists_url":"https://api.github.com/users/andreweduffy/gists{/gist_id}","starred_url":"https://api.github.com/users/andreweduffy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andreweduffy/subscriptions","organizations_url":"https://api.github.com/users/andreweduffy/orgs","repos_url":"https://api.github.com/users/andreweduffy/repos","events_url":"https://api.github.com/users/andreweduffy/events{/privacy}","received_events_url":"https://api.github.com/users/andreweduffy/received_events","type":"User","site_admin":false},"repo":{"id":47751397,"name":"codalab-cli","full_name":"andreweduffy/codalab-cli","owner":{"login":"andreweduffy","id":332583,"avatar_url":"https://avatars.githubusercontent.com/u/332583?v=3","gravatar_id":"","url":"https://api.github.com/users/andreweduffy","html_url":"https://github.com/andreweduffy","followers_url":"https://api.github.com/users/andreweduffy/followers","following_url":"https://api.github.com/users/andreweduffy/following{/other_user}","gists_url":"https://api.github.com/users/andreweduffy/gists{/gist_id}","starred_url":"https://api.github.com/users/andreweduffy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andreweduffy/subscriptions","organizations_url":"https://api.github.com/users/andreweduffy/orgs","repos_url":"https://api.github.com/users/andreweduffy/repos","events_url":"https://api.github.com/users/andreweduffy/events{/privacy}","received_events_url":"https://api.github.com/users/andreweduffy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/andreweduffy/codalab-cli","description":"Bundle service and command-line interface for supporting worksheets in CodaLab.","fork":true,"url":"https://api.github.com/repos/andreweduffy/codalab-cli","forks_url":"https://api.github.com/repos/andreweduffy/codalab-cli/forks","keys_url":"https://api.github.com/repos/andreweduffy/codalab-cli/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andreweduffy/codalab-cli/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andreweduffy/codalab-cli/teams","hooks_url":"https://api.github.com/repos/andreweduffy/codalab-cli/hooks","issue_events_url":"https://api.github.com/repos/andreweduffy/codalab-cli/issues/events{/number}","events_url":"https://api.github.com/repos/andreweduffy/codalab-cli/events","assignees_url":"https://api.github.com/repos/andreweduffy/codalab-cli/assignees{/user}","branches_url":"https://api.github.com/repos/andreweduffy/codalab-cli/branches{/branch}","tags_url":"https://api.github.com/repos/andreweduffy/codalab-cli/tags","blobs_url":"https://api.github.com/repos/andreweduffy/codalab-cli/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andreweduffy/codalab-cli/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andreweduffy/codalab-cli/git/refs{/sha}","trees_url":"https://api.github.com/repos/andreweduffy/codalab-cli/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andreweduffy/codalab-cli/statuses/{sha}","languages_url":"https://api.github.com/repos/andreweduffy/codalab-cli/languages","stargazers_url":"https://api.github.com/repos/andreweduffy/codalab-cli/stargazers","contributors_url":"https://api.github.com/repos/andreweduffy/codalab-cli/contributors","subscribers_url":"https://api.github.com/repos/andreweduffy/codalab-cli/subscribers","subscription_url":"https://api.github.com/repos/andreweduffy/codalab-cli/subscription","commits_url":"https://api.github.com/repos/andreweduffy/codalab-cli/commits{/sha}","git_commits_url":"https://api.github.com/repos/andreweduffy/codalab-cli/git/commits{/sha}","comments_url":"https://api.github.com/repos/andreweduffy/codalab-cli/comments{/number}","issue_comment_url":"https://api.github.com/repos/andreweduffy/codalab-cli/issues/comments{/number}","contents_url":"https://api.github.com/repos/andreweduffy/codalab-cli/contents/{+path}","compare_url":"https://api.github.com/repos/andreweduffy/codalab-cli/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andreweduffy/codalab-cli/merges","archive_url":"https://api.github.com/repos/andreweduffy/codalab-cli/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andreweduffy/codalab-cli/downloads","issues_url":"https://api.github.com/repos/andreweduffy/codalab-cli/issues{/number}","pulls_url":"https://api.github.com/repos/andreweduffy/codalab-cli/pulls{/number}","milestones_url":"https://api.github.com/repos/andreweduffy/codalab-cli/milestones{/number}","notifications_url":"https://api.github.com/repos/andreweduffy/codalab-cli/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andreweduffy/codalab-cli/labels{/name}","releases_url":"https://api.github.com/repos/andreweduffy/codalab-cli/releases{/id}","created_at":"2015-12-10T09:26:46Z","updated_at":"2015-12-10T09:26:47Z","pushed_at":"2015-12-21T22:17:28Z","git_url":"git://github.com/andreweduffy/codalab-cli.git","ssh_url":"git@github.com:andreweduffy/codalab-cli.git","clone_url":"https://github.com/andreweduffy/codalab-cli.git","svn_url":"https://github.com/andreweduffy/codalab-cli","homepage":null,"size":1895,"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":"codalab:develop","ref":"develop","sha":"05ed76a9b4388acc9a59554a349fd66753fca42e","user":{"login":"codalab","id":4633552,"avatar_url":"https://avatars.githubusercontent.com/u/4633552?v=3","gravatar_id":"","url":"https://api.github.com/users/codalab","html_url":"https://github.com/codalab","followers_url":"https://api.github.com/users/codalab/followers","following_url":"https://api.github.com/users/codalab/following{/other_user}","gists_url":"https://api.github.com/users/codalab/gists{/gist_id}","starred_url":"https://api.github.com/users/codalab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codalab/subscriptions","organizations_url":"https://api.github.com/users/codalab/orgs","repos_url":"https://api.github.com/users/codalab/repos","events_url":"https://api.github.com/users/codalab/events{/privacy}","received_events_url":"https://api.github.com/users/codalab/received_events","type":"User","site_admin":false},"repo":{"id":27352490,"name":"codalab-cli","full_name":"codalab/codalab-cli","owner":{"login":"codalab","id":4633552,"avatar_url":"https://avatars.githubusercontent.com/u/4633552?v=3","gravatar_id":"","url":"https://api.github.com/users/codalab","html_url":"https://github.com/codalab","followers_url":"https://api.github.com/users/codalab/followers","following_url":"https://api.github.com/users/codalab/following{/other_user}","gists_url":"https://api.github.com/users/codalab/gists{/gist_id}","starred_url":"https://api.github.com/users/codalab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codalab/subscriptions","organizations_url":"https://api.github.com/users/codalab/orgs","repos_url":"https://api.github.com/users/codalab/repos","events_url":"https://api.github.com/users/codalab/events{/privacy}","received_events_url":"https://api.github.com/users/codalab/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/codalab/codalab-cli","description":"Bundle service and command-line interface for supporting worksheets in CodaLab.","fork":false,"url":"https://api.github.com/repos/codalab/codalab-cli","forks_url":"https://api.github.com/repos/codalab/codalab-cli/forks","keys_url":"https://api.github.com/repos/codalab/codalab-cli/keys{/key_id}","collaborators_url":"https://api.github.com/repos/codalab/codalab-cli/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/codalab/codalab-cli/teams","hooks_url":"https://api.github.com/repos/codalab/codalab-cli/hooks","issue_events_url":"https://api.github.com/repos/codalab/codalab-cli/issues/events{/number}","events_url":"https://api.github.com/repos/codalab/codalab-cli/events","assignees_url":"https://api.github.com/repos/codalab/codalab-cli/assignees{/user}","branches_url":"https://api.github.com/repos/codalab/codalab-cli/branches{/branch}","tags_url":"https://api.github.com/repos/codalab/codalab-cli/tags","blobs_url":"https://api.github.com/repos/codalab/codalab-cli/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/codalab/codalab-cli/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/codalab/codalab-cli/git/refs{/sha}","trees_url":"https://api.github.com/repos/codalab/codalab-cli/git/trees{/sha}","statuses_url":"https://api.github.com/repos/codalab/codalab-cli/statuses/{sha}","languages_url":"https://api.github.com/repos/codalab/codalab-cli/languages","stargazers_url":"https://api.github.com/repos/codalab/codalab-cli/stargazers","contributors_url":"https://api.github.com/repos/codalab/codalab-cli/contributors","subscribers_url":"https://api.github.com/repos/codalab/codalab-cli/subscribers","subscription_url":"https://api.github.com/repos/codalab/codalab-cli/subscription","commits_url":"https://api.github.com/repos/codalab/codalab-cli/commits{/sha}","git_commits_url":"https://api.github.com/repos/codalab/codalab-cli/git/commits{/sha}","comments_url":"https://api.github.com/repos/codalab/codalab-cli/comments{/number}","issue_comment_url":"https://api.github.com/repos/codalab/codalab-cli/issues/comments{/number}","contents_url":"https://api.github.com/repos/codalab/codalab-cli/contents/{+path}","compare_url":"https://api.github.com/repos/codalab/codalab-cli/compare/{base}...{head}","merges_url":"https://api.github.com/repos/codalab/codalab-cli/merges","archive_url":"https://api.github.com/repos/codalab/codalab-cli/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/codalab/codalab-cli/downloads","issues_url":"https://api.github.com/repos/codalab/codalab-cli/issues{/number}","pulls_url":"https://api.github.com/repos/codalab/codalab-cli/pulls{/number}","milestones_url":"https://api.github.com/repos/codalab/codalab-cli/milestones{/number}","notifications_url":"https://api.github.com/repos/codalab/codalab-cli/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/codalab/codalab-cli/labels{/name}","releases_url":"https://api.github.com/repos/codalab/codalab-cli/releases{/id}","created_at":"2014-11-30T22:33:18Z","updated_at":"2015-12-15T14:56:30Z","pushed_at":"2015-12-21T22:17:29Z","git_url":"git://github.com/codalab/codalab-cli.git","ssh_url":"git@github.com:codalab/codalab-cli.git","clone_url":"https://github.com/codalab/codalab-cli.git","svn_url":"https://github.com/codalab/codalab-cli","homepage":null,"size":1893,"stargazers_count":7,"watchers_count":7,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":10,"mirror_url":null,"open_issues_count":44,"forks":10,"open_issues":44,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/codalab/codalab-cli/pulls/290"},"html":{"href":"https://github.com/codalab/codalab-cli/pull/290"},"issue":{"href":"https://api.github.com/repos/codalab/codalab-cli/issues/290"},"comments":{"href":"https://api.github.com/repos/codalab/codalab-cli/issues/290/comments"},"review_comments":{"href":"https://api.github.com/repos/codalab/codalab-cli/pulls/290/comments"},"review_comment":{"href":"https://api.github.com/repos/codalab/codalab-cli/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/codalab/codalab-cli/pulls/290/commits"},"statuses":{"href":"https://api.github.com/repos/codalab/codalab-cli/statuses/3cd98e9a4c45df2ca34670b5dcb7043e476687fe"}}}}