ATS Resource¶
Base resource class
-
class
kissats.ats_resource.
ResourceReservation
(resource_name, ats_client, mode='exclusive', max_retry=5, max_wait=None)¶ Bases:
object
An ATS Resource …
Parameters: - resource_name (str) – The name of the resource
- ats_client (BaseATSClient) – ATS client class for communication to the ATS reservation system
- mode (str) – “exclusive” or “shared”, default “exclusive”
- max_retry (int) – Max number of time to attempt to reserve the resource before raising an exception
- max_wait (float) – Max time to wait for the resource to become available before raising an exception
-
add_retry_count
()¶ Add another retry to the counter
if retry count exceeds max retry, will raise
Raises: ResourceRetryExceeded
-
end_time
¶ Epoch end time of the reservation
-
first_request_time
¶ Epoch time of the first request to reserve the resource
-
get_next_avail_time
()¶ Get the epoch time when a resource will become available.
Warning
Does not reserve or claim the resource
Returns: - min keys:
- available (bool) True if available at the time requested
- avail_start (float)
- avail_end (float)
Return type: dict
-
max_retry
¶ Max number of times to attempt to reserve the resource
-
max_wait_time
¶ Max amount of time in seconds to wait for the resource to become available.
Warning
If set to None, will wait indefinitely
-
name
¶ Name of the resource
-
pre_res_expire
¶ Epoch expiration time of the pre_reservation_id
-
pre_reservation_id
¶ ID returned by a successful reservation
- If reservation is claimed, value is None
- If no reservation has been requested, value is None
-
release_reservation
()¶ Release the current reservation or claim
-
request_reservation
(new_start_time=None, new_end_time=None, next_available=True)¶ request a reservation
-
reservation_id
¶ ID of the currently claimed reservation.
If not currently reserved and claimed, value is None
-
reservation_mode
¶ Reservation mode. IE – exclusive or shared
-
resource_config
¶ The current or requested configuration of the resource
- If the resource has not been reserved, the configuration to request.
- If the resource is reserved the actual configuration returned by the ATS
-
retry_count
¶ Number of unsuccessful attempts to reserve or claim the resource
-
start_time
¶ Epoch start time of the reservation