{"action":"created","comment":{"url":"https://api.github.com/repos/dask/distributed/pulls/comments/73141465","id":73141465,"diff_hunk":"@@ -0,0 +1,34 @@\n+import socket\n+import logging\n+\n+import click\n+\n+from tornado.ioloop import IOLoop\n+from distributed.submit.remote_client import RemoteClient\n+\n+from distributed.utils import get_ip\n+\n+logger = logging.getLogger('distributed.remote')\n+\n+\n+@click.command()\n+@click.option('--host', type=str, default=None,\n+              help=\"IP or hostname of this server\")\n+@click.option('--port', type=int, default=8788, help=\"Remote Client Port\")\n+def remote(host, port):\n+    _remote(host, port)\n+\n+\n+\n+def _remote(host, port, loop=IOLoop.current(), client=RemoteClient):\n+    host = host or get_ip()\n+    if ':' in host and port == 8788:\n+        host, port = host.rsplit(':', 1)\n+        port = int(port)\n+    ip = socket.gethostbyname(host)\n+    remote_client = client(ip=ip, loop=loop)\n+    remote_client.start(port=port)\n+    loop.start()\n+    loop.close()\n+    remote_client.stop()\n+    logger.info(\"End remote client at %s:%d\", host, port)","path":"distributed/submit/remote_cli.py","position":34,"original_position":34,"commit_id":"8d06540f849aa015eb30a73308526a5aea432416","original_commit_id":"8d06540f849aa015eb30a73308526a5aea432416","user":{"login":"mrocklin","id":306380,"avatar_url":"https://avatars.githubusercontent.com/u/306380?v=3","gravatar_id":"","url":"https://api.github.com/users/mrocklin","html_url":"https://github.com/mrocklin","followers_url":"https://api.github.com/users/mrocklin/followers","following_url":"https://api.github.com/users/mrocklin/following{/other_user}","gists_url":"https://api.github.com/users/mrocklin/gists{/gist_id}","starred_url":"https://api.github.com/users/mrocklin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrocklin/subscriptions","organizations_url":"https://api.github.com/users/mrocklin/orgs","repos_url":"https://api.github.com/users/mrocklin/repos","events_url":"https://api.github.com/users/mrocklin/events{/privacy}","received_events_url":"https://api.github.com/users/mrocklin/received_events","type":"User","site_admin":false},"body":"I apologize, my comments from before that it's nice to bring out a lot of logic from the CLI module weren't entirely clear.  \r\n\r\nWhat I meant to say was that it's nice to have tests that don't rely on cli technology, like click and opening processes, but instead rely on the code that those cli modules use.  In the case of submit I suspect that what I'm suggesting is that we create tests based on `RemoteClient` and the `_submit` coroutine, not that we bring the click stuff out from the cli directory into other directories.  Click stuff should definitely stay in CLI.  Starting and stopping IOLoops should probably stay there as well.  Ideally we find a way to test most of the logic of our code without using these technologies; that way we can rely on the testing framework to set up and close down IOLoops and processes for us cleanly.  This should reduce testing frustration.","created_at":"2016-08-02T11:58:15Z","updated_at":"2016-08-02T11:58:15Z","html_url":"https://github.com/dask/distributed/pull/360#discussion_r73141465","pull_request_url":"https://api.github.com/repos/dask/distributed/pulls/360","_links":{"self":{"href":"https://api.github.com/repos/dask/distributed/pulls/comments/73141465"},"html":{"href":"https://github.com/dask/distributed/pull/360#discussion_r73141465"},"pull_request":{"href":"https://api.github.com/repos/dask/distributed/pulls/360"}}},"pull_request":{"url":"https://api.github.com/repos/dask/distributed/pulls/360","id":75562225,"html_url":"https://github.com/dask/distributed/pull/360","diff_url":"https://github.com/dask/distributed/pull/360.diff","patch_url":"https://github.com/dask/distributed/pull/360.patch","issue_url":"https://api.github.com/repos/dask/distributed/issues/360","number":360,"state":"open","locked":false,"title":"Feature dask submit [#351]","user":{"login":"hussainsultan","id":3936122,"avatar_url":"https://avatars.githubusercontent.com/u/3936122?v=3","gravatar_id":"","url":"https://api.github.com/users/hussainsultan","html_url":"https://github.com/hussainsultan","followers_url":"https://api.github.com/users/hussainsultan/followers","following_url":"https://api.github.com/users/hussainsultan/following{/other_user}","gists_url":"https://api.github.com/users/hussainsultan/gists{/gist_id}","starred_url":"https://api.github.com/users/hussainsultan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hussainsultan/subscriptions","organizations_url":"https://api.github.com/users/hussainsultan/orgs","repos_url":"https://api.github.com/users/hussainsultan/repos","events_url":"https://api.github.com/users/hussainsultan/events{/privacy}","received_events_url":"https://api.github.com/users/hussainsultan/received_events","type":"User","site_admin":false},"body":"This is work in progress and i am putting it here for general review and CI feedback.\r\n### TODO\r\n\r\n- [x] Add traceback to `dask-submit`\r\n- [x] Add `dask-remote` cli\r\n- [x] Make cli an executable \r\n- [x] Figure out how to test the CLI best\r\n\r\ncurrent status:\r\n\r\nlocal cluster setup:\r\n\r\n```\r\n$ dask-scheduler\r\n$ dask-worker 127.0.0.1:8786\r\n$ dask-remote\r\n```\r\n\r\n```\r\n$ dask-submit 127.0.0.1:8788 script.py \r\nb'11\\n'\r\n```\r\nwhere \r\n\r\nscript.py:\r\n````python\r\nfrom distributed import Executor\r\n\r\ndef inc(x):\r\n    return x + 1\r\n\r\nif __name__=='__main__':\r\n    executor = Executor('10.34.13.61:8786')\r\n    x = executor.submit(inc, 10)\r\n    print(x.result())\r\n```\r\n\r\n","created_at":"2016-06-28T22:37:43Z","updated_at":"2016-08-02T11:58:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ce800199001429d2e0c8092e6e235f767e1adf96","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/dask/distributed/pulls/360/commits","review_comments_url":"https://api.github.com/repos/dask/distributed/pulls/360/comments","review_comment_url":"https://api.github.com/repos/dask/distributed/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dask/distributed/issues/360/comments","statuses_url":"https://api.github.com/repos/dask/distributed/statuses/8d06540f849aa015eb30a73308526a5aea432416","head":{"label":"hussainsultan:feature-dask-submit","ref":"feature-dask-submit","sha":"8d06540f849aa015eb30a73308526a5aea432416","user":{"login":"hussainsultan","id":3936122,"avatar_url":"https://avatars.githubusercontent.com/u/3936122?v=3","gravatar_id":"","url":"https://api.github.com/users/hussainsultan","html_url":"https://github.com/hussainsultan","followers_url":"https://api.github.com/users/hussainsultan/followers","following_url":"https://api.github.com/users/hussainsultan/following{/other_user}","gists_url":"https://api.github.com/users/hussainsultan/gists{/gist_id}","starred_url":"https://api.github.com/users/hussainsultan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hussainsultan/subscriptions","organizations_url":"https://api.github.com/users/hussainsultan/orgs","repos_url":"https://api.github.com/users/hussainsultan/repos","events_url":"https://api.github.com/users/hussainsultan/events{/privacy}","received_events_url":"https://api.github.com/users/hussainsultan/received_events","type":"User","site_admin":false},"repo":{"id":62074681,"name":"distributed","full_name":"hussainsultan/distributed","owner":{"login":"hussainsultan","id":3936122,"avatar_url":"https://avatars.githubusercontent.com/u/3936122?v=3","gravatar_id":"","url":"https://api.github.com/users/hussainsultan","html_url":"https://github.com/hussainsultan","followers_url":"https://api.github.com/users/hussainsultan/followers","following_url":"https://api.github.com/users/hussainsultan/following{/other_user}","gists_url":"https://api.github.com/users/hussainsultan/gists{/gist_id}","starred_url":"https://api.github.com/users/hussainsultan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hussainsultan/subscriptions","organizations_url":"https://api.github.com/users/hussainsultan/orgs","repos_url":"https://api.github.com/users/hussainsultan/repos","events_url":"https://api.github.com/users/hussainsultan/events{/privacy}","received_events_url":"https://api.github.com/users/hussainsultan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hussainsultan/distributed","description":"Distributed computation in Python","fork":true,"url":"https://api.github.com/repos/hussainsultan/distributed","forks_url":"https://api.github.com/repos/hussainsultan/distributed/forks","keys_url":"https://api.github.com/repos/hussainsultan/distributed/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hussainsultan/distributed/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hussainsultan/distributed/teams","hooks_url":"https://api.github.com/repos/hussainsultan/distributed/hooks","issue_events_url":"https://api.github.com/repos/hussainsultan/distributed/issues/events{/number}","events_url":"https://api.github.com/repos/hussainsultan/distributed/events","assignees_url":"https://api.github.com/repos/hussainsultan/distributed/assignees{/user}","branches_url":"https://api.github.com/repos/hussainsultan/distributed/branches{/branch}","tags_url":"https://api.github.com/repos/hussainsultan/distributed/tags","blobs_url":"https://api.github.com/repos/hussainsultan/distributed/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hussainsultan/distributed/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hussainsultan/distributed/git/refs{/sha}","trees_url":"https://api.github.com/repos/hussainsultan/distributed/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hussainsultan/distributed/statuses/{sha}","languages_url":"https://api.github.com/repos/hussainsultan/distributed/languages","stargazers_url":"https://api.github.com/repos/hussainsultan/distributed/stargazers","contributors_url":"https://api.github.com/repos/hussainsultan/distributed/contributors","subscribers_url":"https://api.github.com/repos/hussainsultan/distributed/subscribers","subscription_url":"https://api.github.com/repos/hussainsultan/distributed/subscription","commits_url":"https://api.github.com/repos/hussainsultan/distributed/commits{/sha}","git_commits_url":"https://api.github.com/repos/hussainsultan/distributed/git/commits{/sha}","comments_url":"https://api.github.com/repos/hussainsultan/distributed/comments{/number}","issue_comment_url":"https://api.github.com/repos/hussainsultan/distributed/issues/comments{/number}","contents_url":"https://api.github.com/repos/hussainsultan/distributed/contents/{+path}","compare_url":"https://api.github.com/repos/hussainsultan/distributed/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hussainsultan/distributed/merges","archive_url":"https://api.github.com/repos/hussainsultan/distributed/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hussainsultan/distributed/downloads","issues_url":"https://api.github.com/repos/hussainsultan/distributed/issues{/number}","pulls_url":"https://api.github.com/repos/hussainsultan/distributed/pulls{/number}","milestones_url":"https://api.github.com/repos/hussainsultan/distributed/milestones{/number}","notifications_url":"https://api.github.com/repos/hussainsultan/distributed/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hussainsultan/distributed/labels{/name}","releases_url":"https://api.github.com/repos/hussainsultan/distributed/releases{/id}","deployments_url":"https://api.github.com/repos/hussainsultan/distributed/deployments","created_at":"2016-06-27T17:27:57Z","updated_at":"2016-06-27T17:27:58Z","pushed_at":"2016-07-28T19:38:53Z","git_url":"git://github.com/hussainsultan/distributed.git","ssh_url":"git@github.com:hussainsultan/distributed.git","clone_url":"https://github.com/hussainsultan/distributed.git","svn_url":"https://github.com/hussainsultan/distributed","homepage":"http://distributed.readthedocs.io/en/latest/","size":2719,"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":"dask:master","ref":"master","sha":"6505f0598a3a2abf3526abfc830fa7d51ab6f7fa","user":{"login":"dask","id":17131925,"avatar_url":"https://avatars.githubusercontent.com/u/17131925?v=3","gravatar_id":"","url":"https://api.github.com/users/dask","html_url":"https://github.com/dask","followers_url":"https://api.github.com/users/dask/followers","following_url":"https://api.github.com/users/dask/following{/other_user}","gists_url":"https://api.github.com/users/dask/gists{/gist_id}","starred_url":"https://api.github.com/users/dask/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dask/subscriptions","organizations_url":"https://api.github.com/users/dask/orgs","repos_url":"https://api.github.com/users/dask/repos","events_url":"https://api.github.com/users/dask/events{/privacy}","received_events_url":"https://api.github.com/users/dask/received_events","type":"Organization","site_admin":false},"repo":{"id":42408083,"name":"distributed","full_name":"dask/distributed","owner":{"login":"dask","id":17131925,"avatar_url":"https://avatars.githubusercontent.com/u/17131925?v=3","gravatar_id":"","url":"https://api.github.com/users/dask","html_url":"https://github.com/dask","followers_url":"https://api.github.com/users/dask/followers","following_url":"https://api.github.com/users/dask/following{/other_user}","gists_url":"https://api.github.com/users/dask/gists{/gist_id}","starred_url":"https://api.github.com/users/dask/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dask/subscriptions","organizations_url":"https://api.github.com/users/dask/orgs","repos_url":"https://api.github.com/users/dask/repos","events_url":"https://api.github.com/users/dask/events{/privacy}","received_events_url":"https://api.github.com/users/dask/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dask/distributed","description":"Distributed computation in Python","fork":false,"url":"https://api.github.com/repos/dask/distributed","forks_url":"https://api.github.com/repos/dask/distributed/forks","keys_url":"https://api.github.com/repos/dask/distributed/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dask/distributed/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dask/distributed/teams","hooks_url":"https://api.github.com/repos/dask/distributed/hooks","issue_events_url":"https://api.github.com/repos/dask/distributed/issues/events{/number}","events_url":"https://api.github.com/repos/dask/distributed/events","assignees_url":"https://api.github.com/repos/dask/distributed/assignees{/user}","branches_url":"https://api.github.com/repos/dask/distributed/branches{/branch}","tags_url":"https://api.github.com/repos/dask/distributed/tags","blobs_url":"https://api.github.com/repos/dask/distributed/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dask/distributed/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dask/distributed/git/refs{/sha}","trees_url":"https://api.github.com/repos/dask/distributed/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dask/distributed/statuses/{sha}","languages_url":"https://api.github.com/repos/dask/distributed/languages","stargazers_url":"https://api.github.com/repos/dask/distributed/stargazers","contributors_url":"https://api.github.com/repos/dask/distributed/contributors","subscribers_url":"https://api.github.com/repos/dask/distributed/subscribers","subscription_url":"https://api.github.com/repos/dask/distributed/subscription","commits_url":"https://api.github.com/repos/dask/distributed/commits{/sha}","git_commits_url":"https://api.github.com/repos/dask/distributed/git/commits{/sha}","comments_url":"https://api.github.com/repos/dask/distributed/comments{/number}","issue_comment_url":"https://api.github.com/repos/dask/distributed/issues/comments{/number}","contents_url":"https://api.github.com/repos/dask/distributed/contents/{+path}","compare_url":"https://api.github.com/repos/dask/distributed/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dask/distributed/merges","archive_url":"https://api.github.com/repos/dask/distributed/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dask/distributed/downloads","issues_url":"https://api.github.com/repos/dask/distributed/issues{/number}","pulls_url":"https://api.github.com/repos/dask/distributed/pulls{/number}","milestones_url":"https://api.github.com/repos/dask/distributed/milestones{/number}","notifications_url":"https://api.github.com/repos/dask/distributed/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dask/distributed/labels{/name}","releases_url":"https://api.github.com/repos/dask/distributed/releases{/id}","deployments_url":"https://api.github.com/repos/dask/distributed/deployments","created_at":"2015-09-13T18:42:29Z","updated_at":"2016-07-28T14:55:12Z","pushed_at":"2016-08-02T01:00:33Z","git_url":"git://github.com/dask/distributed.git","ssh_url":"git@github.com:dask/distributed.git","clone_url":"https://github.com/dask/distributed.git","svn_url":"https://github.com/dask/distributed","homepage":"http://distributed.readthedocs.io/en/latest/","size":2894,"stargazers_count":129,"watchers_count":129,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":47,"mirror_url":null,"open_issues_count":44,"forks":47,"open_issues":44,"watchers":129,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dask/distributed/pulls/360"},"html":{"href":"https://github.com/dask/distributed/pull/360"},"issue":{"href":"https://api.github.com/repos/dask/distributed/issues/360"},"comments":{"href":"https://api.github.com/repos/dask/distributed/issues/360/comments"},"review_comments":{"href":"https://api.github.com/repos/dask/distributed/pulls/360/comments"},"review_comment":{"href":"https://api.github.com/repos/dask/distributed/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dask/distributed/pulls/360/commits"},"statuses":{"href":"https://api.github.com/repos/dask/distributed/statuses/8d06540f849aa015eb30a73308526a5aea432416"}}}}
{"actor":{"display_login":"mrocklin"}}