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

clean up locks when EasyBuild session is cancelled with signal like SIGTERM #3291

Merged
merged 10 commits into from
May 1, 2020

Conversation

boegel
Copy link
Member

@boegel boegel commented Apr 19, 2020

cfr. #3280

@boegel boegel added this to the next release (4.2.1?) milestone Apr 19, 2020
Comment on lines 1518 to 1522
if wait_on_lock:
while os.path.exists(lock_path):
print_msg("lock %s exists, waiting %d seconds..." % (lock_path, wait_on_lock),
silent=build_option('silent'))
time.sleep(wait_on_lock)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expect wait_on_lock to be the max time to wait, not how long between checks. That's what you would normally do in this situation, i.e. specify a max time to wait.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we need a way to limit the time you're waiting for a lock, and the semantics of --wait-on-lock is a bit weird right now.

So, I changed things in d879cda:

  • --wait-on-lock still works as before (0 (the default) implies no waiting (raise an error if lock is already there), a value implies enabling waiting with interval of specified number of seconds), but is deprecated;
  • --wait-on-lock-limit can be used to i) enable waiting for lock to be released, ii) specify a maximum waiting time (if set to 0 is implies no waiting (raise error if lock is there), if set to -1 it implies waiting indefinitely);
  • --wait-on-lock-interval can be used to specify the interval for re-checking whether the lock has been released (default 60 sec.)

easybuild/tools/filetools.py Outdated Show resolved Hide resolved
easybuild/tools/filetools.py Outdated Show resolved Hide resolved
Copy link
Contributor

@akesandgren akesandgren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@akesandgren
Copy link
Contributor

Going in, thanks @boegel!

@akesandgren akesandgren merged commit 4b29b70 into easybuilders:develop May 1, 2020
@boegel boegel deleted the lock_cleanup branch May 1, 2020 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants