BatchClient.GetSubTasksAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
GetSubTasksAsync(String, String, Nullable<Int32>, Nullable<DateTimeOffset>, IEnumerable<String>, RequestContext) |
[Protocol Method] Lists all of the subtasks that are associated with the specified multi-instance Task.
|
GetSubTasksAsync(String, String, Nullable<Int32>, Nullable<DateTimeOffset>, IEnumerable<String>, CancellationToken) |
Lists all of the subtasks that are associated with the specified multi-instance Task. |
GetSubTasksAsync(String, String, Nullable<Int32>, Nullable<DateTimeOffset>, IEnumerable<String>, RequestContext)
- Source:
- BatchClient.cs
[Protocol Method] Lists all of the subtasks that are associated with the specified multi-instance Task.
- This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- Please try the simpler GetSubTasksAsync(String, String, Nullable<Int32>, Nullable<DateTimeOffset>, IEnumerable<String>, CancellationToken) convenience overload with strongly typed models first.
public virtual Azure.AsyncPageable<BinaryData> GetSubTasksAsync (string jobId, string taskId, int? timeOutInSeconds, DateTimeOffset? ocpdate, System.Collections.Generic.IEnumerable<string> select, Azure.RequestContext context);
abstract member GetSubTasksAsync : string * string * Nullable<int> * Nullable<DateTimeOffset> * seq<string> * Azure.RequestContext -> Azure.AsyncPageable<BinaryData>
override this.GetSubTasksAsync : string * string * Nullable<int> * Nullable<DateTimeOffset> * seq<string> * Azure.RequestContext -> Azure.AsyncPageable<BinaryData>
Public Overridable Function GetSubTasksAsync (jobId As String, taskId As String, timeOutInSeconds As Nullable(Of Integer), ocpdate As Nullable(Of DateTimeOffset), select As IEnumerable(Of String), context As RequestContext) As AsyncPageable(Of BinaryData)
Parameters
- jobId
- String
The ID of the Job.
- taskId
- String
The ID of the Task.
The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
- ocpdate
- Nullable<DateTimeOffset>
The time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly.
- select
- IEnumerable<String>
An OData $select clause.
- context
- RequestContext
The request context, which can override default behaviors of the client pipeline on a per-call basis.
Returns
The AsyncPageable<T> from the service containing a list of BinaryData objects. Details of the body schema for each item in the collection are in the Remarks section below.
Exceptions
jobId
or taskId
is null.
jobId
or taskId
is an empty string, and was expected to be non-empty.
Service returned a non-success status code.
Examples
This sample shows how to call GetSubTasksAsync and parse the result.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
BatchClient client = new BatchClient(endpoint, credential);
await foreach (BinaryData item in client.GetSubTasksAsync("<jobId>", "<taskId>", null, null, null, null))
{
JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
Console.WriteLine(result.ToString());
}
This sample shows how to call GetSubTasksAsync with all parameters and parse the result.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
BatchClient client = new BatchClient(endpoint, credential);
await foreach (BinaryData item in client.GetSubTasksAsync("<jobId>", "<taskId>", 1234, DateTimeOffset.Parse("Tue, 10 May 2022 18:57:31 GMT"), new string[] { "<select>" }, null))
{
JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
Console.WriteLine(result.GetProperty("id").ToString());
Console.WriteLine(result.GetProperty("nodeInfo").GetProperty("affinityId").ToString());
Console.WriteLine(result.GetProperty("nodeInfo").GetProperty("nodeUrl").ToString());
Console.WriteLine(result.GetProperty("nodeInfo").GetProperty("poolId").ToString());
Console.WriteLine(result.GetProperty("nodeInfo").GetProperty("nodeId").ToString());
Console.WriteLine(result.GetProperty("nodeInfo").GetProperty("taskRootDirectory").ToString());
Console.WriteLine(result.GetProperty("nodeInfo").GetProperty("taskRootDirectoryUrl").ToString());
Console.WriteLine(result.GetProperty("startTime").ToString());
Console.WriteLine(result.GetProperty("endTime").ToString());
Console.WriteLine(result.GetProperty("exitCode").ToString());
Console.WriteLine(result.GetProperty("containerInfo").GetProperty("containerId").ToString());
Console.WriteLine(result.GetProperty("containerInfo").GetProperty("state").ToString());
Console.WriteLine(result.GetProperty("containerInfo").GetProperty("error").ToString());
Console.WriteLine(result.GetProperty("failureInfo").GetProperty("category").ToString());
Console.WriteLine(result.GetProperty("failureInfo").GetProperty("code").ToString());
Console.WriteLine(result.GetProperty("failureInfo").GetProperty("message").ToString());
Console.WriteLine(result.GetProperty("failureInfo").GetProperty("details")[0].GetProperty("name").ToString());
Console.WriteLine(result.GetProperty("failureInfo").GetProperty("details")[0].GetProperty("value").ToString());
Console.WriteLine(result.GetProperty("state").ToString());
Console.WriteLine(result.GetProperty("stateTransitionTime").ToString());
Console.WriteLine(result.GetProperty("previousState").ToString());
Console.WriteLine(result.GetProperty("previousStateTransitionTime").ToString());
Console.WriteLine(result.GetProperty("result").ToString());
}
Applies to
GetSubTasksAsync(String, String, Nullable<Int32>, Nullable<DateTimeOffset>, IEnumerable<String>, CancellationToken)
- Source:
- BatchClient.cs
Lists all of the subtasks that are associated with the specified multi-instance Task.
public virtual Azure.AsyncPageable<Azure.Compute.Batch.BatchSubtask> GetSubTasksAsync (string jobId, string taskId, int? timeOutInSeconds = default, DateTimeOffset? ocpdate = default, System.Collections.Generic.IEnumerable<string> select = default, System.Threading.CancellationToken cancellationToken = default);
abstract member GetSubTasksAsync : string * string * Nullable<int> * Nullable<DateTimeOffset> * seq<string> * System.Threading.CancellationToken -> Azure.AsyncPageable<Azure.Compute.Batch.BatchSubtask>
override this.GetSubTasksAsync : string * string * Nullable<int> * Nullable<DateTimeOffset> * seq<string> * System.Threading.CancellationToken -> Azure.AsyncPageable<Azure.Compute.Batch.BatchSubtask>
Public Overridable Function GetSubTasksAsync (jobId As String, taskId As String, Optional timeOutInSeconds As Nullable(Of Integer) = Nothing, Optional ocpdate As Nullable(Of DateTimeOffset) = Nothing, Optional select As IEnumerable(Of String) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As AsyncPageable(Of BatchSubtask)
Parameters
- jobId
- String
The ID of the Job.
- taskId
- String
The ID of the Task.
The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
- ocpdate
- Nullable<DateTimeOffset>
The time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly.
- select
- IEnumerable<String>
An OData $select clause.
- cancellationToken
- CancellationToken
The cancellation token to use.
Returns
Exceptions
jobId
or taskId
is null.
jobId
or taskId
is an empty string, and was expected to be non-empty.
Examples
This sample shows how to call GetSubTasksAsync.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
BatchClient client = new BatchClient(endpoint, credential);
await foreach (BatchSubtask item in client.GetSubTasksAsync("<jobId>", "<taskId>"))
{
}
This sample shows how to call GetSubTasksAsync with all parameters.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
BatchClient client = new BatchClient(endpoint, credential);
await foreach (BatchSubtask item in client.GetSubTasksAsync("<jobId>", "<taskId>", timeOutInSeconds: 1234, ocpdate: DateTimeOffset.Parse("Tue, 10 May 2022 18:57:31 GMT"), select: new string[] { "<select>" }))
{
}
Remarks
If the Task is not a multi-instance Task then this returns an empty collection.
Applies to
Azure SDK for .NET