-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Closed
Description
The service will return "Cancelled" (with two "l"s), "Cancelling", and "ValidationFailed".
Here are the status strings that azure-core polling currently checks to see if the operation has reached a terminal state: https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/core/azure-core/azure/core/polling/base_polling.py#L52-L54
We need to check for these nonstandard statuses or the LRO will run forever.
Options:
- Simply map the nonstandard statuses to those of the ones checked in the
get_statusmethod:
if status:
if status == "ValidationFailed":
return "Failed"
elif status in ["Cancelled", "Cancelling"]:
return "Canceled"
return status
else:
raise BadResponse("No status found in body")
- Define a custom polling method that will inherit from LROBasePolling and override the methods checking for a terminal state like here in Text Analytics: https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_lro.py#L32
I favor option 1, but we might need to re-evaluate if it makes sense with the current error states of the service. E.g. if we map "ValidationFailed" to a status == "Failed", now we will throw an exception instead of just returning the JobStatusDetail when wait_until_done is called by the user.
Reactions are currently unavailable