How to cancel Document AI train job? I have the job running but it does not appear in gcloud when listing jobs
Solved! Go to Solution.
Hello,
Thank you for contacting the Google Cloud Community.
Since gcloud doesn't list the job, we need to use the Document AI API directly. Here's how to find the job ID:
Once you have the job ID, you can cancel it using the Document AI API. Here are the steps depending on your chosen method:
Using Client Libraries:
Refer to the documentation for your chosen client library to find the method for canceling a job. The method name might be something like cancel_operation or delete_operation.
Provide the job ID to the cancel method to stop the running job.
Using API Explorer:
In the API Explorer, locate the "Operations" section and find the "cancel" endpoint.
Provide the job ID in the request body and execute the API call. This should cancel the job.
Regards,
Jai Ade
Hello,
Thank you for contacting the Google Cloud Community.
Since gcloud doesn't list the job, we need to use the Document AI API directly. Here's how to find the job ID:
Once you have the job ID, you can cancel it using the Document AI API. Here are the steps depending on your chosen method:
Using Client Libraries:
Refer to the documentation for your chosen client library to find the method for canceling a job. The method name might be something like cancel_operation or delete_operation.
Provide the job ID to the cancel method to stop the running job.
Using API Explorer:
In the API Explorer, locate the "Operations" section and find the "cancel" endpoint.
Provide the job ID in the request body and execute the API call. This should cancel the job.
Regards,
Jai Ade
Dear Jaja,
Your solution does not seem to solve the problem. There seems to be no way to cancel an existing training run using the Python SDK. The client library documented here does not contain any functionalities to delete ongoing training runs. When executing
request = documentai.DeleteProcessorVersionRequest(name="...")
client = documentai.DocumentProcessorServiceClient()
client.delete_processor_version(request=request)
the following error is thrown:
FailedPrecondition: 400 ProcessorVersion state cannot be changed to 'DELETING' since it is 'CREATING'. [reason: "PROCESSOR_VERSION_STATE_CHANGE_INVALID"
domain: "documentai.googleapis.com"
metadata {
key: "version_id"
value: "VALUE_HIDDEN"
}
metadata {
key: "target_state"
value: "DELETING"
}
metadata {
key: "processor_id"
value: "VALUE_HIDDEN"
}
metadata {
key: "current_state"
value: "CREATING"
}
]
Could you please assist on how to delete/stop/cancel an ongoing training run that is incurring costs?
Best,
Renato
Hello,
Thank you for your engagement regarding this issue. We haven’t heard back from you regarding this issue for sometime now. Hence, I'm going to close this issue which will no longer be monitored. However, if you have any new issues, Please don’t hesitate to create a new issue. We will be happy to assist you on the same.
Regards,
Jai Ade
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |