Coordinator/place keepalive#1884
Open
asher-pem-arm wants to merge 1 commit into
Open
Conversation
Member
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #1884 +/- ##
========================================
- Coverage 46.0% 45.1% -0.9%
========================================
Files 180 180
Lines 14464 14764 +300
========================================
+ Hits 6654 6667 +13
- Misses 7810 8097 +287
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
Place acquisition is currently indefinite, which can lead to stale locks when users stop interacting with a place without releasing it. Add a lease-based locking mode that allows places to be acquired for a limited time and expire automatically unless extended. Leases are tied to the lifetime of a reservation. This prevents stale locks and reduces the need for manual cleanup. Signed-off-by: Asher Pemberton <asher.pemberton@arm.com> Reviewed-by: Asher Pemberton <asher.pemberton@arm.com> # gatekeeper Co-authored-by: Idan Saadon <idan.saadon@arm.com>
e65832f to
34865ac
Compare
Author
|
@Emantor updated to drop other commit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background:
Labgrid currently supports place acquisition, but acquired places remain locked until they are released explicitly.
In practice, this can lead to stale locks, where a place stays occupied even after the user is no longer actively using it.
This reduces availability of shared lab resources and often requires manual intervention to recover locked places.
What problem this solves
This MR introduces lease-based place locking, allowing places to be acquired for a limited time and released automatically if the lease is not extended.
This prevents stale locks and keeps place usage self-cleaning, while also integrating naturally with the existing reservation and scheduler semantics.
Overview:
This change adds a new lease acquisition mode alongside the existing acquire mode:
be extended explicitly
Leased places are released automatically when the associated reservation expires, is cancelled, or when lease extension fails.
Lease timing and limits
Lease timing is not user-configurable via CLI. Instead, it is governed by coordinator configuration:
This design ensures consistent behavior across users and prevents misuse or overly long locks.
Lease extension failure behavior
If extending a lease fails (for example due to exporter/resource errors),
the coordinator will cancel the lease and release the place.
This avoids leaving the system in a partially extended or inconsistent state,
especially when a place consists of multiple resources.
From the user perspective, a failed extend means the lease is no longer valid
and the place must be leased again.
CLI examples
Create a reservation:
labgrid-client reserve board=imx8 # the LG_TOKEN will be printed upon successLease a place using the dedicated
leasecommand:labgrid-client -p +<LG_TOKEN> leaseExtend the reservation to keep the lease alive:
labgrid-client extend <LG_TOKEN> --keepalive # automatically renews lease until failure or max durationAcquire a place indefinitely (unchanged behaviour):
labgrid-client -p board-01 lockor
labgrid-client -p board-01 acquire