Skip to content

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

Merged
akesandgren merged 10 commits intoeasybuilders:developfrom
boegel:lock_cleanup
May 1, 2020
Merged

clean up locks when EasyBuild session is cancelled with signal like SIGTERM#3291
akesandgren merged 10 commits intoeasybuilders:developfrom
boegel:lock_cleanup

Conversation

@boegel
Copy link
Copy Markdown
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 thread easybuild/tools/filetools.py Outdated
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
Copy Markdown
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
Copy Markdown
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.)

Comment thread easybuild/tools/filetools.py Outdated
Comment thread easybuild/tools/filetools.py Outdated
Copy link
Copy Markdown
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
Copy Markdown
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