google-api-python-client icon indicating copy to clipboard operation
google-api-python-client copied to clipboard

Cloud Run Job v2 API does not include the `force` query parameter for Jobs.Delete

Open japerry911 opened this issue 1 year ago • 1 comments

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

  1. Try to add force=True query parameter to client.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!

japerry911 avatar Sep 30 '23 16:09 japerry911

Screenshot 2023-09-30 at 10 01 34 AM

Screenshot for reference

  • https://cloud.google.com/run/docs/reference/rest/v2/projects.locations.jobs/delete

japerry911 avatar Sep 30 '23 16:09 japerry911