resources.VidigiPriorityStore

resources.VidigiPriorityStore(
    self,
    env,
    num_resources=None,
    capacity=float('inf'),
)

An optimized SimPy priority store that eliminates delays between resource release and acquisition by directly triggering waiting events.

This implementation provides the same API as the original VidigiPriorityStore but with immediate resource handoff between processes.

AI USE DISCLOSURE: This code was generated by Claude 3.7 Sonnet. It has been evaluated and tested by a human.

Methods

Name Description
cancel_get Cancels a pending get request by removing it from the queue.
get Create an event to get an item from the store.
get_direct Get an item from the store without the context manager.
populate Populate this VidigiPriorityStore with VidigiResource objects.
put Put an item into the store.
request Request context manager for getting an item from the store.
request_direct Alias for get_direct() to maintain consistent API.
return_item Return an item to the store and immediately process any waiting get requests.

cancel_get

resources.VidigiPriorityStore.cancel_get(get_event)

Cancels a pending get request by removing it from the queue.

get

resources.VidigiPriorityStore.get(priority=0)

Create an event to get an item from the store.

Args: priority: Lower values indicate higher priority (default: 0)

Returns: A get event that can be yielded

get_direct

resources.VidigiPriorityStore.get_direct(priority=0)

Get an item from the store without the context manager. Use this if you don’t want to automatically return the item.

Returns: A get event that can be yielded

populate

resources.VidigiPriorityStore.populate(num_resources)

Populate this VidigiPriorityStore with VidigiResource objects.

Creates num_resources VidigiResource objects and adds them to this store.

Each VidigiResource is initialized with a capacity of 1 and a unique ID starting at 1.

Parameters

Name Type Description Default
num_resources int The number of VidigiResource objects to create and add to the store. required

Returns

Name Type Description
None

put

resources.VidigiPriorityStore.put(item)

Put an item into the store.

Args: item: The item to put in the store

Returns: A put event that can be yielded

request

resources.VidigiPriorityStore.request(priority=0)

Request context manager for getting an item from the store. The item is automatically returned when exiting the context.

Args: priority: Lower values indicate higher priority (default: 0)

Returns: A context manager that yields the get event and handles item return

request_direct

resources.VidigiPriorityStore.request_direct(priority=0)

Alias for get_direct() to maintain consistent API.

Returns: A get event that can be yielded

return_item

resources.VidigiPriorityStore.return_item(item)

Return an item to the store and immediately process any waiting get requests.

This is the key to eliminating delays - it directly triggers waiting get requests without going through the normal put/get mechanism.

Args: item: The item to return to the store