# Human-Readable Python Code:
The following code snippet is an asynchronous method named `cancel_reservation_async` that cancels a quantum reservation. It takes in three arguments: `project_id`, `processor_id`, and `reservation_id`, all of which are strings.
```python
async def cancel_reservation_async(
self, project_id: str, processor_id: str, reservation_id: str
):
"""Cancels a quantum reservation.
This action is only valid if the associated [QuantumProcessor]
schedule not been frozen. Otherwise, delete_reservation should
be used.
The reservation will be truncated to end at the time when the request is
serviced and any remaining time will be made available as an open swim
period. This action will only succeed if the reservation has not yet
ended and is within the processor's freeze window. If the reservation
has already ended or is beyond the processor's freeze window, then the
call will return an error.
Args:
project_id: A project_id of the parent Google Cloud Project.
processor_id: The processor unique identifier.
reservation_id: Unique ID of the reservation in the parent project,
"""
# Create the reservation name using the project_id, processor_id,
# and reservation_id
name = _reservation_name_from_ids(project_id, processor_id, reservation_id)
# Create a cancel reservation request object with the reservation name
request = quantum.CancelQuantumReservationRequest(name=name)
# Send the cancel reservation request asynchronously and return the response
return await self._send_request_async(self.grpc_client.cancel_quantum_reservation, request)
Note: The code snippet provided does not include the definition of the _reservation_name_from_ids
function.
| Associated Context | |
| ------------------------------------------ | ---------------------------------------- |
| Type | Code Snippet ( ***.py*** ) |
| Associated Tags | No Tags Associated |
| Description | 'No Description Provided' |
| Related Links | No Related Links |
| Related People | [David Merwin](mailto:davidmerwin1992@gmail.com) |
| Sensitive Information | No Sensitive Information Detected |
| Shareable Link | https://davidmerwin.pieces.cloud/?p=fc1245a189 |
https://gist.github.com/davidmerwin/c835e409b05285be611817e0319f190b?permalink_comment_id=4771138#gistcomment-4771138