Make the build server and build worker slightly more robust to errors.
This commit is contained in:
parent
d3d593f7e1
commit
5e81f999d1
2 changed files with 5 additions and 3 deletions
|
@ -124,7 +124,7 @@ def build_image(build_dir, tag_name, num_steps, result_object):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.exception('Exception when processing request.')
|
logger.exception('Exception when processing request.')
|
||||||
result_object['status'] = 'error'
|
result_object['status'] = 'error'
|
||||||
result_object['message'] = e.message
|
result_object['message'] = str(e.message)
|
||||||
|
|
||||||
|
|
||||||
MIME_PROCESSORS = {
|
MIME_PROCESSORS = {
|
||||||
|
|
|
@ -43,7 +43,7 @@ def retry_command(to_call, args=[], kwargs={}, retries=5, period=5):
|
||||||
|
|
||||||
|
|
||||||
def get_status(url):
|
def get_status(url):
|
||||||
return requests.get(url).json()['status']
|
return retry_command(requests.get, [url]).json()['status']
|
||||||
|
|
||||||
|
|
||||||
def babysit_builder(request):
|
def babysit_builder(request):
|
||||||
|
@ -112,8 +112,10 @@ def babysit_builder(request):
|
||||||
ssh_client = paramiko.SSHClient()
|
ssh_client = paramiko.SSHClient()
|
||||||
ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||||
|
|
||||||
|
logger.debug('Connecting to droplet through ssh at ip: %s' %
|
||||||
|
droplet.ip_address)
|
||||||
retry_command(ssh_client.connect, [droplet.ip_address, 22, 'root'],
|
retry_command(ssh_client.connect, [droplet.ip_address, 22, 'root'],
|
||||||
{'look_for_keys': False,
|
{'look_for_keys': False, 'timeout': 10.0,
|
||||||
'key_filename': app.config['DO_SSH_PRIVATE_KEY_FILENAME']})
|
'key_filename': app.config['DO_SSH_PRIVATE_KEY_FILENAME']})
|
||||||
|
|
||||||
# Load the node with the pull token
|
# Load the node with the pull token
|
||||||
|
|
Reference in a new issue