Share via


ComputeBatchModelFactory.BatchTaskCreateContent Method

Definition

Initializes a new instance of BatchTaskCreateContent.

public static Azure.Compute.Batch.BatchTaskCreateContent BatchTaskCreateContent (string id = default, string displayName = default, Azure.Compute.Batch.ExitConditions exitConditions = default, string commandLine = default, Azure.Compute.Batch.BatchTaskContainerSettings containerSettings = default, System.Collections.Generic.IEnumerable<Azure.Compute.Batch.ResourceFile> resourceFiles = default, System.Collections.Generic.IEnumerable<Azure.Compute.Batch.OutputFile> outputFiles = default, System.Collections.Generic.IEnumerable<Azure.Compute.Batch.EnvironmentSetting> environmentSettings = default, Azure.Compute.Batch.AffinityInfo affinityInfo = default, Azure.Compute.Batch.BatchTaskConstraints constraints = default, int? requiredSlots = default, Azure.Compute.Batch.UserIdentity userIdentity = default, Azure.Compute.Batch.MultiInstanceSettings multiInstanceSettings = default, Azure.Compute.Batch.BatchTaskDependencies dependsOn = default, System.Collections.Generic.IEnumerable<Azure.Compute.Batch.BatchApplicationPackageReference> applicationPackageReferences = default, Azure.Compute.Batch.AuthenticationTokenSettings authenticationTokenSettings = default);
static member BatchTaskCreateContent : string * string * Azure.Compute.Batch.ExitConditions * string * Azure.Compute.Batch.BatchTaskContainerSettings * seq<Azure.Compute.Batch.ResourceFile> * seq<Azure.Compute.Batch.OutputFile> * seq<Azure.Compute.Batch.EnvironmentSetting> * Azure.Compute.Batch.AffinityInfo * Azure.Compute.Batch.BatchTaskConstraints * Nullable<int> * Azure.Compute.Batch.UserIdentity * Azure.Compute.Batch.MultiInstanceSettings * Azure.Compute.Batch.BatchTaskDependencies * seq<Azure.Compute.Batch.BatchApplicationPackageReference> * Azure.Compute.Batch.AuthenticationTokenSettings -> Azure.Compute.Batch.BatchTaskCreateContent
Public Shared Function BatchTaskCreateContent (Optional id As String = Nothing, Optional displayName As String = Nothing, Optional exitConditions As ExitConditions = Nothing, Optional commandLine As String = Nothing, Optional containerSettings As BatchTaskContainerSettings = Nothing, Optional resourceFiles As IEnumerable(Of ResourceFile) = Nothing, Optional outputFiles As IEnumerable(Of OutputFile) = Nothing, Optional environmentSettings As IEnumerable(Of EnvironmentSetting) = Nothing, Optional affinityInfo As AffinityInfo = Nothing, Optional constraints As BatchTaskConstraints = Nothing, Optional requiredSlots As Nullable(Of Integer) = Nothing, Optional userIdentity As UserIdentity = Nothing, Optional multiInstanceSettings As MultiInstanceSettings = Nothing, Optional dependsOn As BatchTaskDependencies = Nothing, Optional applicationPackageReferences As IEnumerable(Of BatchApplicationPackageReference) = Nothing, Optional authenticationTokenSettings As AuthenticationTokenSettings = Nothing) As BatchTaskCreateContent

Parameters

id
String

A string that uniquely identifies the Task within the Job. The ID can contain any combination of alphanumeric characters including hyphens and underscores, and cannot contain more than 64 characters. The ID is case-preserving and case-insensitive (that is, you may not have two IDs within a Job that differ only by case).

displayName
String

A display name for the Task. The display name need not be unique and can contain any Unicode characters up to a maximum length of 1024.

exitConditions
ExitConditions

How the Batch service should respond when the Task completes.

commandLine
String

The command line of the Task. For multi-instance Tasks, the command line is executed as the primary Task, after the primary Task and all subtasks have finished executing the coordination command line. The command line does not run under a shell, and therefore cannot take advantage of shell features such as environment variable expansion. If you want to take advantage of such features, you should invoke the shell in the command line, for example using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" in Linux. If the command line refers to file paths, it should use a relative path (relative to the Task working directory), or use the Batch provided environment variable (https://docs.microsoft.com/en-us/azure/batch/batch-compute-node-environment-variables).

containerSettings
BatchTaskContainerSettings

The settings for the container under which the Task runs. If the Pool that will run this Task has containerConfiguration set, this must be set as well. If the Pool that will run this Task doesn't have containerConfiguration set, this must not be set. When this is specified, all directories recursively below the AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) are mapped into the container, all Task environment variables are mapped into the container, and the Task command line is executed in the container. Files produced in the container outside of AZ_BATCH_NODE_ROOT_DIR might not be reflected to the host disk, meaning that Batch file APIs will not be able to access those files.

resourceFiles
IEnumerable<ResourceFile>

A list of files that the Batch service will download to the Compute Node before running the command line. For multi-instance Tasks, the resource files will only be downloaded to the Compute Node on which the primary Task is executed. There is a maximum size for the list of resource files. When the max size is exceeded, the request will fail and the response error code will be RequestEntityTooLarge. If this occurs, the collection of ResourceFiles must be reduced in size. This can be achieved using .zip files, Application Packages, or Docker Containers.

outputFiles
IEnumerable<OutputFile>

A list of files that the Batch service will upload from the Compute Node after running the command line. For multi-instance Tasks, the files will only be uploaded from the Compute Node on which the primary Task is executed.

environmentSettings
IEnumerable<EnvironmentSetting>

A list of environment variable settings for the Task.

affinityInfo
AffinityInfo

A locality hint that can be used by the Batch service to select a Compute Node on which to start the new Task.

constraints
BatchTaskConstraints

The execution constraints that apply to this Task. If you do not specify constraints, the maxTaskRetryCount is the maxTaskRetryCount specified for the Job, the maxWallClockTime is infinite, and the retentionTime is 7 days.

requiredSlots
Nullable<Int32>

The number of scheduling slots that the Task required to run. The default is 1. A Task can only be scheduled to run on a compute node if the node has enough free scheduling slots available. For multi-instance Tasks, this must be 1.

userIdentity
UserIdentity

The user identity under which the Task runs. If omitted, the Task runs as a non-administrative user unique to the Task.

multiInstanceSettings
MultiInstanceSettings

An object that indicates that the Task is a multi-instance Task, and contains information about how to run the multi-instance Task.

dependsOn
BatchTaskDependencies

The Tasks that this Task depends on. This Task will not be scheduled until all Tasks that it depends on have completed successfully. If any of those Tasks fail and exhaust their retry counts, this Task will never be scheduled. If the Job does not have usesTaskDependencies set to true, and this element is present, the request fails with error code TaskDependenciesNotSpecifiedOnJob.

applicationPackageReferences
IEnumerable<BatchApplicationPackageReference>

A list of Packages that the Batch service will deploy to the Compute Node before running the command line. Application packages are downloaded and deployed to a shared directory, not the Task working directory. Therefore, if a referenced package is already on the Node, and is up to date, then it is not re-downloaded; the existing copy on the Compute Node is used. If a referenced Package cannot be installed, for example because the package has been deleted or because download failed, the Task fails.

authenticationTokenSettings
AuthenticationTokenSettings

The settings for an authentication token that the Task can use to perform Batch service operations. If this property is set, the Batch service provides the Task with an authentication token which can be used to authenticate Batch service operations without requiring an Account access key. The token is provided via the AZ_BATCH_AUTHENTICATION_TOKEN environment variable. The operations that the Task can carry out using the token depend on the settings. For example, a Task can request Job permissions in order to add other Tasks to the Job, or check the status of the Job or of other Tasks under the Job.

Returns

A new BatchTaskCreateContent instance for mocking.

Applies to