你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
ConversationAuthoringClient.CancelTrainingJobAsync 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
[协议方法]触发正在运行的训练作业的取消。
- 此 协议方法 允许显式创建请求并处理高级方案的响应。
public virtual System.Threading.Tasks.Task<Azure.Operation<BinaryData>> CancelTrainingJobAsync (Azure.WaitUntil waitUntil, string projectName, string jobId, Azure.RequestContext context = default);
abstract member CancelTrainingJobAsync : Azure.WaitUntil * string * string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Operation<BinaryData>>
override this.CancelTrainingJobAsync : Azure.WaitUntil * string * string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Operation<BinaryData>>
Public Overridable Function CancelTrainingJobAsync (waitUntil As WaitUntil, projectName As String, jobId As String, Optional context As RequestContext = Nothing) As Task(Of Operation(Of BinaryData))
参数
- waitUntil
- WaitUntil
Completed 如果方法应在服务上完成长时间运行的操作之前等待返回,则为 ; Started 如果它在启动操作后应返回,则为 。 有关长时间运行的操作的详细信息,请参阅 Azure.Core Long-Running 操作示例。
- projectName
- String
要使用的项目的名称。
- jobId
- String
作业 ID。
- context
- RequestContext
请求上下文,它可以基于每个调用替代客户端管道的默认行为。
返回
表示 Operation 服务上的异步操作的 。
例外
projectName
或 jobId
为 null。
projectName
或 jobId
是空字符串,预期为非空。
服务返回了不成功状态代码。
示例
此示例演示如何使用所需的参数调用 CancelTrainingJobAsync 并分析结果。
var credential = new AzureKeyCredential("<key>");
var endpoint = new Uri("<https://my-service.azure.com>");
var client = new ConversationAuthoringClient(endpoint, credential);
var operation = await client.CancelTrainingJobAsync(WaitUntil.Completed, "<projectName>", "<jobId>");
BinaryData responseData = operation.Value;
JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement;
Console.WriteLine(result.GetProperty("result").GetProperty("modelLabel").ToString());
Console.WriteLine(result.GetProperty("result").GetProperty("trainingConfigVersion").ToString());
Console.WriteLine(result.GetProperty("result").GetProperty("trainingMode").ToString());
Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("percentComplete").ToString());
Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("startDateTime").ToString());
Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("endDateTime").ToString());
Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("status").ToString());
Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("percentComplete").ToString());
Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("startDateTime").ToString());
Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("endDateTime").ToString());
Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("status").ToString());
Console.WriteLine(result.GetProperty("result").GetProperty("estimatedEndDateTime").ToString());
Console.WriteLine(result.GetProperty("jobId").ToString());
Console.WriteLine(result.GetProperty("createdDateTime").ToString());
Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString());
Console.WriteLine(result.GetProperty("expirationDateTime").ToString());
Console.WriteLine(result.GetProperty("status").ToString());
Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString());
Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString());
Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString());
Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString());
Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString());
Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString());
Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString());
Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString());
Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString());
Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString());
Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("<test>").ToString());
Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString());
Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString());
Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString());
Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("<test>").ToString());
Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString());
注解
可以在服务 REST API 文档中找到其他信息: https://learn.microsoft.com/rest/api/language/2023-04-01/conversational-analysis-authoring/cancel-training-job