.NET DPG LRO is making an extra GET call to the resource URI, breaking documented response schema
See original GitHub issueFor Sample5_ImportProject.cs in PR #29340, the ImportProject
and Train
LROs are working as expected based on the session file, but the DeployProject
has an extra GET
and I can’t tell where it’s coming from. Specifically, the initial LRO request indeed returns a 202 with an Operation-Location
to a status monitor:
"StatusCode": 202,
"ResponseHeaders": {
"Access-Control-Expose-Headers": "*",
"apim-request-id": "3d75422d-f5fe-4bcd-8cdc-c1b240e63a78",
"Content-Length": "0",
"Date": "Wed, 15 Jun 2022 01:02:17 GMT",
"operation-location": "https://languagesdkresource.cognitiveservices.azure.com/language/authoring/analyze-conversations/projects/net-conv-367666463/deployments/production/jobs/ff2585da-967b-41dc-8f05-0a854689e260_637908480000000000?api-version=2022-05-01",
"request-id": "3d75422d-f5fe-4bcd-8cdc-c1b240e63a78",
"Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload",
"X-Content-Type-Options": "nosniff",
"x-envoy-upstream-service-time": "101"
},
"ResponseBody": null
The next several requests are what you’d expect - status
is running
- until the final status update:
{
"RequestUri": "https://languagesdkresource.cognitiveservices.azure.com/language/authoring/analyze-conversations/projects/net-conv-367666463/deployments/production/jobs/ff2585da-967b-41dc-8f05-0a854689e260_637908480000000000?api-version=2022-05-01",
"RequestMethod": "GET",
"RequestHeaders": {
"Ocp-Apim-Subscription-Key": "Sanitized",
"User-Agent": "azsdk-net-AI.Language.Conversations/1.0.0-alpha.20220614.1 (.NET 6.0.5; Microsoft Windows 10.0.22000)",
"x-ms-client-request-id": "ccc3e9c28c3c019344e0e2ad20829ff8",
"x-ms-return-client-request-id": "true"
},
"RequestBody": null,
"StatusCode": 200,
"ResponseHeaders": {
"Access-Control-Expose-Headers": "*",
"apim-request-id": "eb1b0550-ca5f-4a97-a177-169f5fdaaad4",
"Content-Length": "218",
"Content-Type": "application/json; charset=utf-8",
"Date": "Wed, 15 Jun 2022 01:02:22 GMT",
"request-id": "eb1b0550-ca5f-4a97-a177-169f5fdaaad4",
"Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload",
"X-Content-Type-Options": "nosniff",
"x-envoy-upstream-service-time": "24"
},
"ResponseBody": {
"jobId": "ff2585da-967b-41dc-8f05-0a854689e260_637908480000000000",
"createdDateTime": "2022-06-15T01:02:17Z",
"lastUpdatedDateTime": "2022-06-15T01:02:22Z",
"expirationDateTime": "2022-06-22T01:02:17Z",
"status": "succeeded"
}
},
But then immediately afterward, there’s this extra GET which is what the Operation<BinaryData>.Value
ultimately contains:
{
"RequestUri": "https://languagesdkresource.cognitiveservices.azure.com/language/authoring/analyze-conversations/projects/net-conv-367666463/deployments/production?api-version=2022-05-01",
"RequestMethod": "GET",
"RequestHeaders": {
"Ocp-Apim-Subscription-Key": "Sanitized",
"User-Agent": "azsdk-net-AI.Language.Conversations/1.0.0-alpha.20220614.1 (.NET 6.0.5; Microsoft Windows 10.0.22000)",
"x-ms-client-request-id": "8c11e8cce5e682c8638a22cdb3087be4",
"x-ms-return-client-request-id": "true"
},
"RequestBody": null,
"StatusCode": 200,
"ResponseHeaders": {
"Access-Control-Expose-Headers": "*",
"apim-request-id": "35de4d51-fcec-4df0-82ca-c06206d6f36f",
"Content-Length": "281",
"Content-Type": "application/json; charset=utf-8",
"Date": "Wed, 15 Jun 2022 01:02:23 GMT",
"request-id": "35de4d51-fcec-4df0-82ca-c06206d6f36f",
"Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload",
"X-Content-Type-Options": "nosniff",
"x-envoy-upstream-service-time": "22"
},
"ResponseBody": {
"deploymentName": "production",
"modelId": "Sample5-20220615T010216-aeac9f0032944941b024163bc3ebff89",
"lastTrainedDateTime": "2022-06-15T01:02:16.6869195Z",
"lastDeployedDateTime": "2022-06-15T01:02:22Z",
"deploymentExpirationDate": "2023-10-28",
"modelTrainingConfigVersion": "2022-05-01"
}
}
I can’t tell from where this comes? Why is the LRO querying the actual resource? The generated LRO implementation uses OperationFinalStateVia.Location
just like the other aforementioned LROs:
using HttpMessage message = CreateDeployProjectRequest(projectName, deploymentName, content, context);
return LowLevelOperationHelpers.ProcessMessage(_pipeline, message, ClientDiagnostics, "ConversationAnalysisProjectsClient.DeployProject", OperationFinalStateVia.Location, context, waitUntil);
@annelo-msft @AlexanderSher @chunyu3 ? /cc @kristapratico @mshaban-msft @tg-msft @johanste
Some useful links:
DeployProject
LRO: https://github.com/Azure/azure-rest-api-specs/blob/725f4ca360426a32d20e81eb945065e62c285d6a/specification/cognitiveservices/data-plane/Language/stable/2022-05-01/analyzeconversations-authoring.json#L532-L540DeployProject
status monitor: https://github.com/Azure/azure-rest-api-specs/blob/725f4ca360426a32d20e81eb945065e62c285d6a/specification/cognitiveservices/data-plane/Language/stable/2022-05-01/analyzeconversations-authoring.json#L619-L624- That final
DeployProject
resource GET: https://github.com/Azure/azure-rest-api-specs/blob/725f4ca360426a32d20e81eb945065e62c285d6a/specification/cognitiveservices/data-plane/Language/stable/2022-05-01/analyzeconversations-authoring.json#L483-L488
_Originally posted by @heaths in https://github.com/Azure/azure-sdk-for-net/issues/29331#issuecomment-1158191653_
Issue Analytics
- State:
- Created a year ago
- Comments:5 (4 by maintainers)
Top GitHub Comments
Talking offline, we’ll do @kristapratico’s idea for the CLU 1.0 GA:
@annelo-msft I’ll leave it up to you whether you want to keep this issue as a tracking issue for support of this (anti?) pattern.
Based on investigations by @AlexanderSher, @kristapratico, and @lmazuel (thank you all!), we believe the .NET implementation is the same as Python’s implementation and is correct. We make the final GET request because the original request was a PUT, as implemented here: https://github.com/Azure/autorest.csharp/blob/feature/v3/src/assets/Generator.Shared/NextLinkOperationImplementation.cs#L196
Per @lmazuel:
Since the .NET implementation is correct, we will not make changes to the generator or shared source types.