google-api-python-client
google-api-python-client copied to clipboard
Cloud Run Job v2 API does not include the `force` query parameter for Jobs.Delete
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":
- Search the issues already opened: https://github.com/googleapis/google-api-python-client/issues
- Search StackOverflow: https://stackoverflow.com/questions/tagged/google-cloud-platform+python
If you are still having issues, please be sure to include as much information as possible:
Environment details
- Python version:
python --version
-3.10.12
- pip version:
pip --version
-23.0.1
-
google-api-python-client
version:pip show google-api-python-client
-2.101.0
Steps to reproduce
- Try to add
force=True
query parameter toclient.jobs().delete(name=..., force=True)
and it will not work
Code example
# Example 1:
request = cr_client.jobs().delete(
name=f"projects/{project}/locations/{location}/jobs/{job_name}",
force=True,
)
request.execute()
# Example 2:
request = cr_client.jobs().delete(
name=f"projects/{project}/locations/{location}/jobs/{job_name}",
)
# True so Execution is deleted too when job is deleted
request.uri += "&force=true"
request.execute()
Stack trace
# example
googleapiclient.errors.HttpError: <HttpError 400 when requesting https://run.googleapis.com/v2/projects/REDACTED/locations/us-central1/jobs/prefect-cautious-rat?alt=json&force=true returned "Invalid JSON payload received. Unknown name "force": Cannot bind 'true'. Field 'force' could not be found in request message.". Details: "[{'@type': 'type.googleapis.com/google.rpc.BadRequest', 'fieldViolations': [{'description': 'Invalid JSON payload received. Unknown name "force": Cannot bind \'true\'. Field \'force\' could not be found in request message.'}]}]">
Making sure to follow these steps will guarantee the quickest resolution possible.
Thanks!
Screenshot for reference
- https://cloud.google.com/run/docs/reference/rest/v2/projects.locations.jobs/delete