{"action":"created","issue":{"url":"https://api.github.com/repos/blaze/distributed/issues/61","labels_url":"https://api.github.com/repos/blaze/distributed/issues/61/labels{/name}","comments_url":"https://api.github.com/repos/blaze/distributed/issues/61/comments","events_url":"https://api.github.com/repos/blaze/distributed/issues/61/events","html_url":"https://github.com/blaze/distributed/issues/61","id":124526137,"number":61,"title":"dworker should wait for dcenter to come up","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},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-01T01:49:51Z","updated_at":"2016-01-01T02:26:43Z","closed_at":null,"body":"if dworker is running before dcenter process has started, worker never connects to the center. Consider:\r\n\r\n```\r\n$dworker 10.52.10.8:8787\r\ndistributed.nanny - INFO - Nanny starts worker process 10.52.10.8:8788\r\ndistributed.worker - INFO - Start worker at             10.52.10.8:8789\r\ndistributed.worker - INFO - Waiting to connect to       10.52.10.8:8787\r\n```\r\nand then:\r\n\r\n```\r\n$ dcenter \r\ndistributed.dcenter - INFO - Start center at 10.52.10.8:8787\r\n```\r\n\r\nit appears that while dcenter process is running after dworker, dworker does not try to connect with the center again.\r\n\r\nThis is a slight issue when lunching a mesos task with center and worker process; mesos launches all tasks (center and workers) simultaneously, however the cadence of when center and worker task start running may not be in-sync.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/blaze/distributed/issues/comments/168277469","html_url":"https://github.com/blaze/distributed/issues/61#issuecomment-168277469","issue_url":"https://api.github.com/repos/blaze/distributed/issues/61","id":168277469,"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},"created_at":"2016-01-01T02:26:43Z","updated_at":"2016-01-01T02:26:43Z","body":"Hrm, this is odd.  I actually get correct behavior here\r\n\r\n```\r\nmrocklin@notebook:~$ dworker 127.0.0.1:8787\r\ndistributed.nanny - INFO - Start Nanny at:             192.168.1.106:36639\r\ndistributed.worker - INFO - Start worker at             192.168.1.106:39815\r\ndistributed.worker - INFO - Waiting to connect to       127.0.0.1:8787\r\n```\r\n```\r\nmrocklin@notebook:~$ dcenter \r\ndistributed.dcenter - INFO - Start center at 192.168.1.106:8787\r\ndistributed.core - INFO - Connection from 127.0.0.1:51274 to Center\r\ndistributed.center - INFO - Register ('192.168.1.106', 39815)\r\n```\r\n\r\nBy default The worker retries every 500 ms until connection with no timeout\r\n\r\nhttps://github.com/blaze/distributed/blob/master/distributed/worker.py#L106-L114\r\n\r\n```python\r\n        while True:\r\n            try:\r\n                resp = yield self.center.register(\r\n                        ncores=self.ncores, address=(self.ip, self.port),\r\n                        nanny_port=self.nanny_port, keys=list(self.data))\r\n                break\r\n            except OSError:\r\n                logger.debug(\"Unable to register with center.  Waiting\")\r\n                yield gen.sleep(0.5)\r\n```\r\n\r\nPerhaps the exception type is different for different OS's?  I'm on linux."}}