diff --git a/dvc/config.py b/dvc/config.py index 3a4a20d1d..15091ebc9 100644 --- a/dvc/config.py +++ b/dvc/config.py @@ -134,6 +134,7 @@ class Config(object): SECTION_REMOTE_USER = 'user' SECTION_REMOTE_PORT = 'port' SECTION_REMOTE_KEY_FILE = 'keyfile' + SECTION_REMOTE_TIMEOUT = 'timeout' SECTION_REMOTE_SCHEMA = { SECTION_REMOTE_URL: And(supported_url, error="Unsupported URL"), Optional(SECTION_AWS_REGION): str, @@ -145,6 +146,7 @@ class Config(object): Optional(SECTION_REMOTE_USER): str, Optional(SECTION_REMOTE_PORT): Use(int), Optional(SECTION_REMOTE_KEY_FILE): str, + Optional(SECTION_REMOTE_TIMEOUT): Use(int), } SCHEMA = { diff --git a/dvc/remote/ssh.py b/dvc/remote/ssh.py index b6b8afdbb..19da77fcb 100644 --- a/dvc/remote/ssh.py +++ b/dvc/remote/ssh.py @@ -47,6 +47,7 @@ class RemoteSSH(RemoteBase): PARAM_MD5 = 'md5' DEFAULT_PORT = 22 + TIMEOUT = 1800 def __init__(self, project, config): self.project = project @@ -59,6 +60,7 @@ class RemoteSSH(RemoteBase): self.prefix = self.group('path') self.port = config.get(Config.SECTION_REMOTE_PORT, self.DEFAULT_PORT) self.keyfile = config.get(Config.SECTION_REMOTE_KEY_FILE, None) + self.timeout= config.get(Config.SECTION_REMOTE_TIMEOUT, self.TIMEOUT) def md5s_to_path_infos(self, md5s): return [{'scheme': 'ssh', @@ -81,7 +83,8 @@ class RemoteSSH(RemoteBase): ssh.connect(host, username=user, port=port, - key_filename=self.keyfile) + key_filename=self.keyfile, + timeout=self.timeout) return ssh