Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use safe_while to work around an OVH problem #659

Merged
merged 1 commit into from
Oct 19, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion teuthology/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from . import misc
from . import provision
from .config import config
from .contextutil import safe_while
from .lockstatus import get_status

log = logging.getLogger(__name__)
Expand Down Expand Up @@ -513,7 +514,14 @@ def unlock_one(ctx, name, user, description=None):
request = dict(name=name, locked=False, locked_by=user,
description=description)
uri = os.path.join(config.lock_server, 'nodes', name, 'lock', '')
response = requests.put(uri, json.dumps(request))
with safe_while(
sleep=1, increment=0.5, action="unlock %s" % name) as proceed:
while proceed():
try:
response = requests.put(uri, json.dumps(request))
# Work around https://github.com/kennethreitz/requests/issues/2364
except requests.exception.ConnectionError as e:
log.warn("Saw %s while unlocking; retrying...", str(e))
success = response.ok
if success:
log.info('unlocked %s', name)
Expand Down