diff options
author | Holden Karau <holden@pigscanfly.ca> | 2013-04-06 00:35:50 -0700 |
---|---|---|
committer | Holden Karau <holden@pigscanfly.ca> | 2013-04-06 00:35:50 -0700 |
commit | ff2130a0ad17388036b66fcdf2b1848e208fa0f8 (patch) | |
tree | 31c11bbf9c6835bbc05f6ef906e873f430d1e6a1 /ec2/spark_ec2.py | |
parent | 1f5381119f8c8afd0ba69bc7773c10972dd43bc1 (diff) | |
download | spark-ff2130a0ad17388036b66fcdf2b1848e208fa0f8.tar.gz spark-ff2130a0ad17388036b66fcdf2b1848e208fa0f8.tar.bz2 spark-ff2130a0ad17388036b66fcdf2b1848e208fa0f8.zip |
Retry failed ssh commands. This is especially useful during system startup when the hosts may not have yet come on-line but can be useful at other points for people with flakey connections
Diffstat (limited to 'ec2/spark_ec2.py')
-rwxr-xr-x | ec2/spark_ec2.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/ec2/spark_ec2.py b/ec2/spark_ec2.py index 571d27fde6..aa2d360fbb 100755 --- a/ec2/spark_ec2.py +++ b/ec2/spark_ec2.py @@ -22,6 +22,7 @@ from __future__ import with_statement import logging import os import random +from retry_decorator import retry import shutil import subprocess import sys @@ -541,6 +542,7 @@ def scp(host, opts, local_file, dest_file): # Run a command on a host through ssh, throwing an exception if ssh fails +@retry(subprocess.CalledProcessError, tries=3, delay=30) def ssh(host, opts, command): subprocess.check_call( "ssh -t -o StrictHostKeyChecking=no -i %s %s@%s '%s'" % |