This module tracks all known resources managed by the scheduler. The scheduler_msgs/Resource ROS message describes resources used by the Robotics in Concert (ROCON) project.
Request cannot be satisfied as specified.
Error exception: resource not available.
Error exception: resource not owned.
Base class for tracking the status of a single ROCON resource.
Parameters: | msg (ConcertClient, CurrentStatus or Resource) – ROCON scheduler resource description message. |
---|
Returns: | Hash key for this resource. |
---|
Returns: | True if this PoolResource equals the other. |
---|
Returns: | True if this PoolResource differs from the other. |
---|
Returns: | Human-readable string representation of this PoolResource. |
---|
These attributes are also provided:
Fully-resolved canonical ROCON resource name.
Current status of this resource.
Priority of request to which this resource is currently assigned.
Allocate this resource.
Parameters: | request (ActiveRequest) – New owner of this resource. |
---|---|
Raises: | ResourceNotAvailableError if not available |
Match this resource to a requested one.
Parameters: | res (scheduler_msgs/Resource or PoolResource) – Resource request to match. |
---|---|
Returns: | True if this specific resource matches. |
To match, the res.rapp must be one of the rapps advertised by this ROCON resource. The res.uri may include Python regular expression syntax for matching multiple resource names.
If the res.uri is not a canonical ROCON name starting with ‘rocon:’, it will be converted from shell wildcard syntax into an equivalent Python regular expression.
Match this resource to a ROCON name and application.
Parameters: | |
---|---|
Returns: | True if this specific resource matches. |
Raises: | RoconURIValueError if pattern invalid. |
The rapp must be one of those advertised by this ROCON resource. The pattern may be a ROCON pattern matching multiple resource names.
Release this resource.
Parameters: | request_id (uuid.UUID or None) – Optional owning request. |
---|---|
Raises: | ResourceNotOwnedError if request_id is specified and is not the owner. |
This class manages a pool of PoolResource objects known to the scheduler.
Parameters: |
|
---|
ResourcePool supports these standard container operations:
Returns: | The number of resources in the pool. |
---|
Param uri: | (str) The Uniform Resource Identifier of a resource in the pool. |
---|---|
Returns: | The actual pool resource corresponding to uri. |
Raises: | KeyError if uri not in the pool. |
Returns: | True if pool contains uri, else False. |
---|
Equivalent to not uri in pool.
Returns: | Human-readable string representation of this ResourcePool. |
---|
Dictionary of known pool_resource objects, indexed by the fully-resolved ROCON resource name.
True, if resource pool has changed since the previous known_resources() call.
The ResourcePool class this pool contains.
Try to allocate all resources for a request.
Parameters: | request (ActiveRequest) – Scheduler request object, some resources may include regular expression syntax. |
---|---|
Returns: | List of scheduler_msgs/Resource messages allocated, in requested order with platform info fully resolved; or [] if not everything is available. |
Raises: | InvalidRequestError if the request is not valid. |
If successful, matching ROCON resources are allocated to this request. Otherwise, the request remains unchanged.
Try to allocate some permutation of resources for a request.
Parameters: |
|
---|---|
Returns: | List of scheduler_msgs/Resource messages allocated, in requested order with platform info fully resolved; or [] if not everything is available. |
If successful, matching ROCON resources are allocated to this request. Otherwise, the request remains unchanged.
Get named pool resource, if known.
Parameters: |
|
---|---|
Returns: | named pool resource if successful, else default. |
Make a list containing sets of the available resources matching each item in resources.
Parameters: |
|
---|---|
Returns: | List of set containing names of matching resources, empty if any item cannot be satisfied, or there are not enough resources, or the original resources list was empty. |
Make a set of names of all available resources matching resource_msg.
Parameters: |
|
---|---|
Returns: | set containing matching resource names. |
Release all the resources owned by this request.
Parameters: | request (ActiveRequest) – Current owner of resources to release. |
---|
Only appropriate when this request is being closed.
Release a list of resources.
Parameters: |
|
---|
This makes newly allocated resources available again when they cannot be assigned to a request for some reason.