Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

RAG Corpus cannot be deleted due to running operation

Hello, 

I am newer to GCP and recently started following the guide to setup a RAG corpus using vertex AI (https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/rag-api#python

I created a corpus and started import files into it but after a while the process timed out. Now I cannot delete the corpus or start over because there are running operations on the corpus. 

Is there any way to cancel the operation? Using an example url to cancel the process using curl  only throws a 404 error. 
i.e projects/{id}/locations/{location}/ragCorpora/{corpora_id}/operations/{operations_id}:cancel

Thanks in advance 

1 1 78
1 REPLY 1

I tried to cancel the operation using the following function:

 

 

def cancel_operation(service_endpoint, name):
    # Construct the URL
    url = f"https://{service_endpoint}/v1beta1/{name}:cancel"
    
    access_token = get_access_token()
    
    headers = {
        "Authorization": f"Bearer {access_token}",
        "Content-Type": "application/json"
    }
    
    # Empty body as per the API specification
    data = {}
    
    response = requests.post(url, headers=headers, data=json.dumps(data))
    return response

 

The response: 

 

{'code': 400, 'message': 'Operation projects/<id>/locations/<region>operations/<id> is not cancellable.', 'status': 'FAILED_PRECONDITION'}}

 


Upon requesting the status of the operation, the status is shown as unknown:

 

Operation status: Unknown
Operation metadata: {
  "@type": "type.googleapis.com/google.cloud.aiplatform.v1beta1.ImportRagFilesOperationMetadata",
  "genericMetadata": {
    "createTime": "2024-09-11T13:01:52.721723Z",
    "updateTime": "2024-09-11T13:01:52.721723Z"
  },
...