Skip to content
This repository has been archived by the owner on Nov 29, 2023. It is now read-only.

Cancelling a reservation too soon returns GRPC error #201

Closed
greenmtnboy opened this issue Dec 27, 2021 · 2 comments
Closed

Cancelling a reservation too soon returns GRPC error #201

greenmtnboy opened this issue Dec 27, 2021 · 2 comments
Labels
api: bigqueryreservation Issues related to the googleapis/python-bigquery-reservation API. priority: p3 Desirable enhancement or fix. May not be included in next release. 🚨 This issue needs some love. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@greenmtnboy
Copy link

greenmtnboy commented Dec 27, 2021

Expected outcome: raises Cannot delete capacity commitment before commitment end time: 2021-12-27T15:23:00.479018+00:00 .

Instead, raises Attribute ERror.

Thanks for stopping by to let us know something could be better!

PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.

Please run down the following list and make sure you've tried the usual "quick fixes":

If you are still having issues, please be sure to include as much information as possible:

Environment details

  • OS type and version: linux
  • Python version: python --version
  • pip version: pip --version
  • google-cloud-bigquery-reservation version: pip show google-cloud-bigquery-reservation

Relevant google libraries:
google-api-core-2.3.2 google-api-python-client-2.33.0 google-auth-2.3.3 google-auth-httplib2-0.1.0 google-auth-oauthlib-0.4.6 google-cloud-bigquery-2.31.0 google-cloud-bigquery-reservation-1.4.1 google-cloud-core-2.2.1 google-cloud-pubsub-2.9.0 google-cloud-storage-1.43.0 google-crc32c-1.3.0 google-reauth-0.1.1 google-resumable-media-2.1.0 googleapis-common-protos-1.54.0 grpc-google-iam-v1-0.12.3 grpcio-1.43.0

Steps to reproduce

  1. Create flex reservation, immediately try to cancel it.

Code example

# example

Stack trace


<html>
<body>
<!--StartFragment-->

state = <grpc._channel._RPCState object at 0x7ff23ebbd520>
--
  | call = <grpc._cython.cygrpc.SegregatedCall object at 0x7ff23ee620c0>
  | with_call = False, deadline = None
  |  
  | def _end_unary_response_blocking(state, call, with_call, deadline):
  | if state.code is grpc.StatusCode.OK:
  | if with_call:
  | rendezvous = _MultiThreadedRendezvous(state, call, None, deadline)
  | return state.response, rendezvous
  | else:
  | return state.response
  | else:
  | >           raise _InactiveRpcError(state)
  | E           grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
  | E           	status = StatusCode.FAILED_PRECONDITION
  | E           	details = "Cannot delete capacity commitment before commitment end time: 2021-12-27T15:23:00.479018+00:00"
  | E           	debug_error_string = "{"created":"@1640618526.415163192","description":"Error received from peer ipv4:142.250.188.42:443","file":"src/core/lib/surface/call.cc","file_line":1074,"grpc_message":"Cannot delete capacity commitment before commitment end time: 2021-12-27T15:23:00.479018+00:00","grpc_status":9}"
  | E           >
  |  
  | /pyenv/versions/3.8.10/envs/python38-venv/lib/python3.8/site-packages/grpc/_channel.py:849: _InactiveRpcError

<!--EndFragment-->
</body>
</html>

/pyenv/versions/3.8.10/envs/python38-venv/lib/python3.8/site-packages/google/cloud/bigquery_reservation_v1/services/reservation_service/client.py:1152: in delete_capacity_commitment
--
  | rpc(
  | /pyenv/versions/3.8.10/envs/python38-venv/lib/python3.8/site-packages/google/api_core/gapic_v1/method.py:154: in __call__
  | return wrapped_func(*args, **kwargs)
  | /pyenv/versions/3.8.10/envs/python38-venv/lib/python3.8/site-packages/google/api_core/retry.py:283: in retry_wrapped_func
  | return retry_target(
  | /pyenv/versions/3.8.10/envs/python38-venv/lib/python3.8/site-packages/google/api_core/retry.py:190: in retry_target
  | return target()
  | /pyenv/versions/3.8.10/envs/python38-venv/lib/python3.8/site-packages/google/api_core/grpc_helpers.py:68: in error_remapped_callable
  | raise exceptions.from_grpc_error(exc) from exc
  | _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  |  
  | rpc_exc = <_InactiveRpcError of RPC that terminated with:
  | status = StatusCode.FAILED_PRECONDITION
  | details = "Cannot delete cap...e":"Cannot delete capacity commitment before commitment end time: 2021-12-27T15:23:00.479018+00:00","grpc_status":9}"
  | >
  |  
  | def from_grpc_error(rpc_exc):
  | """Create a :class:`GoogleAPICallError` from a :class:`grpc.RpcError`.
  |  
  | Args:
  | rpc_exc (grpc.RpcError): The gRPC error.
  |  
  | Returns:
  | GoogleAPICallError: An instance of the appropriate subclass of
  | :class:`GoogleAPICallError`.
  | """
  | # NOTE(lidiz) All gRPC error shares the parent class grpc.RpcError.
  | # However, check for grpc.RpcError breaks backward compatibility.
  | >       if isinstance(rpc_exc, grpc.Call) or _is_informative_grpc_error(rpc_exc):
  | E       AttributeError: 'NoneType' object has no attribute 'Call'
  |  
  | /pyenv/versions/3.8.10/envs/python38-venv/lib/python3.8/site-packages/google/api_core/exceptions.py:537: AttributeError

]

Making sure to follow these steps will guarantee the quickest resolution possible.

Thanks!

@product-auto-label product-auto-label bot added the api: bigqueryreservation Issues related to the googleapis/python-bigquery-reservation API. label Dec 27, 2021
@yoshi-automation yoshi-automation added triage me I really want to be triaged. 🚨 This issue needs some love. labels Dec 28, 2021
@meredithslota meredithslota added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. and removed 🚨 This issue needs some love. triage me I really want to be triaged. labels Jan 12, 2022
@meredithslota
Copy link

It's intended that "immediate" cancellation doesn't work, though it's somewhat subtle; here is the documentation that explains it: https://cloud.google.com/bigquery/docs/reservations-details#:~:text=You%20cannot%20delete%20a%20flex,seconds%20your%20commitment%20was%20active. However, the error is somewhat confusing as really, you cannot cancel it until 60s (supposedly) after the flex reservation as started, unrelated to end time. I wonder if something else is going on here.

@yoshi-automation yoshi-automation added 🚨 This issue needs some love. and removed 🚨 This issue needs some love. labels Apr 12, 2022
@yoshi-automation yoshi-automation added the 🚨 This issue needs some love. label Jun 25, 2022
@chalmerlowe chalmerlowe added priority: p3 Desirable enhancement or fix. May not be included in next release. and removed priority: p2 Moderately-important priority. Fix may not be included in next release. labels Nov 21, 2022
@parthea
Copy link
Contributor

parthea commented Apr 18, 2023

I'm going to close this issue as there has been no activity for more than 1 year. The issue described appears to be a problem with the API rather than the client library. API related issues should be directed to the public issue tracker by filing an issue here.

@parthea parthea closed this as completed Apr 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api: bigqueryreservation Issues related to the googleapis/python-bigquery-reservation API. priority: p3 Desirable enhancement or fix. May not be included in next release. 🚨 This issue needs some love. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

5 participants