Skip to content
This repository has been archived by the owner on Nov 19, 2020. It is now read-only.

Commit

Permalink
Retry a maxmimum of five times for deploys and errands
Browse files Browse the repository at this point in the history
  • Loading branch information
danhigham committed Mar 16, 2016
1 parent 23d2185 commit 032f2b7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
6 changes: 5 additions & 1 deletion install_steps/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ def do_step(context):

task = client.wait_for_task(task_id)

while task['state'] == 'error':
retries = 0

while task['state'] == 'error' and retries < 5:

retries += 1

print "Retrying deploy for {0}/manifests/{1}...".format(home_dir, m['file'])

Expand Down
13 changes: 12 additions & 1 deletion install_steps/run_errands.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,18 @@ def do_step(context):
print "Running errand {0}".format(errand)

task_id = client.run_errand(m['deployment-name'], errand)
client.wait_for_task(task_id)
task = client.wait_for_task(task_id)

retries = 0

while task['state'] == 'error' and retries < 5:

retries += 1

print "Retrying errand {0}".format(errand)

task_id = client.run_errand(m['deployment-name'], errand)
task = client.wait_for_task(task_id)

result = client.get_task_result(task_id)
print "Errand finished with exit code {0}".format(result['exit_code'])
Expand Down

0 comments on commit 032f2b7

Please sign in to comment.