We recommend using Azure Native.
azure.batch.Job
Explore with Pulumi AI
Manages a Batch Job.
Example Usage
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() =>
{
var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new()
{
Location = "west europe",
});
var exampleAccount = new Azure.Batch.Account("exampleAccount", new()
{
ResourceGroupName = exampleResourceGroup.Name,
Location = exampleResourceGroup.Location,
});
var examplePool = new Azure.Batch.Pool("examplePool", new()
{
ResourceGroupName = exampleResourceGroup.Name,
AccountName = exampleAccount.Name,
NodeAgentSkuId = "batch.node.ubuntu 16.04",
VmSize = "Standard_A1",
FixedScale = new Azure.Batch.Inputs.PoolFixedScaleArgs
{
TargetDedicatedNodes = 1,
},
StorageImageReference = new Azure.Batch.Inputs.PoolStorageImageReferenceArgs
{
Publisher = "Canonical",
Offer = "UbuntuServer",
Sku = "16.04.0-LTS",
Version = "latest",
},
});
var exampleJob = new Azure.Batch.Job("exampleJob", new()
{
BatchPoolId = examplePool.Id,
});
});
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/batch"
"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleResourceGroup, err := core.NewResourceGroup(ctx, "exampleResourceGroup", &core.ResourceGroupArgs{
Location: pulumi.String("west europe"),
})
if err != nil {
return err
}
exampleAccount, err := batch.NewAccount(ctx, "exampleAccount", &batch.AccountArgs{
ResourceGroupName: exampleResourceGroup.Name,
Location: exampleResourceGroup.Location,
})
if err != nil {
return err
}
examplePool, err := batch.NewPool(ctx, "examplePool", &batch.PoolArgs{
ResourceGroupName: exampleResourceGroup.Name,
AccountName: exampleAccount.Name,
NodeAgentSkuId: pulumi.String("batch.node.ubuntu 16.04"),
VmSize: pulumi.String("Standard_A1"),
FixedScale: &batch.PoolFixedScaleArgs{
TargetDedicatedNodes: pulumi.Int(1),
},
StorageImageReference: &batch.PoolStorageImageReferenceArgs{
Publisher: pulumi.String("Canonical"),
Offer: pulumi.String("UbuntuServer"),
Sku: pulumi.String("16.04.0-LTS"),
Version: pulumi.String("latest"),
},
})
if err != nil {
return err
}
_, err = batch.NewJob(ctx, "exampleJob", &batch.JobArgs{
BatchPoolId: examplePool.ID(),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.batch.Account;
import com.pulumi.azure.batch.AccountArgs;
import com.pulumi.azure.batch.Pool;
import com.pulumi.azure.batch.PoolArgs;
import com.pulumi.azure.batch.inputs.PoolFixedScaleArgs;
import com.pulumi.azure.batch.inputs.PoolStorageImageReferenceArgs;
import com.pulumi.azure.batch.Job;
import com.pulumi.azure.batch.JobArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()
.location("west europe")
.build());
var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
.resourceGroupName(exampleResourceGroup.name())
.location(exampleResourceGroup.location())
.build());
var examplePool = new Pool("examplePool", PoolArgs.builder()
.resourceGroupName(exampleResourceGroup.name())
.accountName(exampleAccount.name())
.nodeAgentSkuId("batch.node.ubuntu 16.04")
.vmSize("Standard_A1")
.fixedScale(PoolFixedScaleArgs.builder()
.targetDedicatedNodes(1)
.build())
.storageImageReference(PoolStorageImageReferenceArgs.builder()
.publisher("Canonical")
.offer("UbuntuServer")
.sku("16.04.0-LTS")
.version("latest")
.build())
.build());
var exampleJob = new Job("exampleJob", JobArgs.builder()
.batchPoolId(examplePool.id())
.build());
}
}
import pulumi
import pulumi_azure as azure
example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="west europe")
example_account = azure.batch.Account("exampleAccount",
resource_group_name=example_resource_group.name,
location=example_resource_group.location)
example_pool = azure.batch.Pool("examplePool",
resource_group_name=example_resource_group.name,
account_name=example_account.name,
node_agent_sku_id="batch.node.ubuntu 16.04",
vm_size="Standard_A1",
fixed_scale=azure.batch.PoolFixedScaleArgs(
target_dedicated_nodes=1,
),
storage_image_reference=azure.batch.PoolStorageImageReferenceArgs(
publisher="Canonical",
offer="UbuntuServer",
sku="16.04.0-LTS",
version="latest",
))
example_job = azure.batch.Job("exampleJob", batch_pool_id=example_pool.id)
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "west europe"});
const exampleAccount = new azure.batch.Account("exampleAccount", {
resourceGroupName: exampleResourceGroup.name,
location: exampleResourceGroup.location,
});
const examplePool = new azure.batch.Pool("examplePool", {
resourceGroupName: exampleResourceGroup.name,
accountName: exampleAccount.name,
nodeAgentSkuId: "batch.node.ubuntu 16.04",
vmSize: "Standard_A1",
fixedScale: {
targetDedicatedNodes: 1,
},
storageImageReference: {
publisher: "Canonical",
offer: "UbuntuServer",
sku: "16.04.0-LTS",
version: "latest",
},
});
const exampleJob = new azure.batch.Job("exampleJob", {batchPoolId: examplePool.id});
resources:
exampleResourceGroup:
type: azure:core:ResourceGroup
properties:
location: west europe
exampleAccount:
type: azure:batch:Account
properties:
resourceGroupName: ${exampleResourceGroup.name}
location: ${exampleResourceGroup.location}
examplePool:
type: azure:batch:Pool
properties:
resourceGroupName: ${exampleResourceGroup.name}
accountName: ${exampleAccount.name}
nodeAgentSkuId: batch.node.ubuntu 16.04
vmSize: Standard_A1
fixedScale:
targetDedicatedNodes: 1
storageImageReference:
publisher: Canonical
offer: UbuntuServer
sku: 16.04.0-LTS
version: latest
exampleJob:
type: azure:batch:Job
properties:
batchPoolId: ${examplePool.id}
Create Job Resource
new Job(name: string, args: JobArgs, opts?: CustomResourceOptions);
@overload
def Job(resource_name: str,
opts: Optional[ResourceOptions] = None,
batch_pool_id: Optional[str] = None,
common_environment_properties: Optional[Mapping[str, str]] = None,
display_name: Optional[str] = None,
name: Optional[str] = None,
priority: Optional[int] = None,
task_retry_maximum: Optional[int] = None)
@overload
def Job(resource_name: str,
args: JobArgs,
opts: Optional[ResourceOptions] = None)
func NewJob(ctx *Context, name string, args JobArgs, opts ...ResourceOption) (*Job, error)
public Job(string name, JobArgs args, CustomResourceOptions? opts = null)
type: azure:batch:Job
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args JobArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args JobArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args JobArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args JobArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args JobArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Job Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The Job resource accepts the following input properties:
- Batch
Pool stringId The ID of the Batch Pool. Changing this forces a new Batch Job to be created.
- Common
Environment Dictionary<string, string>Properties Specifies a map of common environment settings applied to this Batch Job. Changing this forces a new Batch Job to be created.
- Display
Name string The display name of this Batch Job. Changing this forces a new Batch Job to be created.
- Name string
The name which should be used for this Batch Job. Changing this forces a new Batch Job to be created.
- Priority int
The priority of this Batch Job, possible values can range from -1000 (lowest) to 1000 (highest). Defaults to
0
.- Task
Retry intMaximum The number of retries to each Batch Task belongs to this Batch Job. If this is set to
0
, the Batch service does not retry Tasks. If this is set to-1
, the Batch service retries Batch Tasks without limit. Default value is0
.
- Batch
Pool stringId The ID of the Batch Pool. Changing this forces a new Batch Job to be created.
- Common
Environment map[string]stringProperties Specifies a map of common environment settings applied to this Batch Job. Changing this forces a new Batch Job to be created.
- Display
Name string The display name of this Batch Job. Changing this forces a new Batch Job to be created.
- Name string
The name which should be used for this Batch Job. Changing this forces a new Batch Job to be created.
- Priority int
The priority of this Batch Job, possible values can range from -1000 (lowest) to 1000 (highest). Defaults to
0
.- Task
Retry intMaximum The number of retries to each Batch Task belongs to this Batch Job. If this is set to
0
, the Batch service does not retry Tasks. If this is set to-1
, the Batch service retries Batch Tasks without limit. Default value is0
.
- batch
Pool StringId The ID of the Batch Pool. Changing this forces a new Batch Job to be created.
- common
Environment Map<String,String>Properties Specifies a map of common environment settings applied to this Batch Job. Changing this forces a new Batch Job to be created.
- display
Name String The display name of this Batch Job. Changing this forces a new Batch Job to be created.
- name String
The name which should be used for this Batch Job. Changing this forces a new Batch Job to be created.
- priority Integer
The priority of this Batch Job, possible values can range from -1000 (lowest) to 1000 (highest). Defaults to
0
.- task
Retry IntegerMaximum The number of retries to each Batch Task belongs to this Batch Job. If this is set to
0
, the Batch service does not retry Tasks. If this is set to-1
, the Batch service retries Batch Tasks without limit. Default value is0
.
- batch
Pool stringId The ID of the Batch Pool. Changing this forces a new Batch Job to be created.
- common
Environment {[key: string]: string}Properties Specifies a map of common environment settings applied to this Batch Job. Changing this forces a new Batch Job to be created.
- display
Name string The display name of this Batch Job. Changing this forces a new Batch Job to be created.
- name string
The name which should be used for this Batch Job. Changing this forces a new Batch Job to be created.
- priority number
The priority of this Batch Job, possible values can range from -1000 (lowest) to 1000 (highest). Defaults to
0
.- task
Retry numberMaximum The number of retries to each Batch Task belongs to this Batch Job. If this is set to
0
, the Batch service does not retry Tasks. If this is set to-1
, the Batch service retries Batch Tasks without limit. Default value is0
.
- batch_
pool_ strid The ID of the Batch Pool. Changing this forces a new Batch Job to be created.
- common_
environment_ Mapping[str, str]properties Specifies a map of common environment settings applied to this Batch Job. Changing this forces a new Batch Job to be created.
- display_
name str The display name of this Batch Job. Changing this forces a new Batch Job to be created.
- name str
The name which should be used for this Batch Job. Changing this forces a new Batch Job to be created.
- priority int
The priority of this Batch Job, possible values can range from -1000 (lowest) to 1000 (highest). Defaults to
0
.- task_
retry_ intmaximum The number of retries to each Batch Task belongs to this Batch Job. If this is set to
0
, the Batch service does not retry Tasks. If this is set to-1
, the Batch service retries Batch Tasks without limit. Default value is0
.
- batch
Pool StringId The ID of the Batch Pool. Changing this forces a new Batch Job to be created.
- common
Environment Map<String>Properties Specifies a map of common environment settings applied to this Batch Job. Changing this forces a new Batch Job to be created.
- display
Name String The display name of this Batch Job. Changing this forces a new Batch Job to be created.
- name String
The name which should be used for this Batch Job. Changing this forces a new Batch Job to be created.
- priority Number
The priority of this Batch Job, possible values can range from -1000 (lowest) to 1000 (highest). Defaults to
0
.- task
Retry NumberMaximum The number of retries to each Batch Task belongs to this Batch Job. If this is set to
0
, the Batch service does not retry Tasks. If this is set to-1
, the Batch service retries Batch Tasks without limit. Default value is0
.
Outputs
All input properties are implicitly available as output properties. Additionally, the Job resource produces the following output properties:
- Id string
The provider-assigned unique ID for this managed resource.
- Id string
The provider-assigned unique ID for this managed resource.
- id String
The provider-assigned unique ID for this managed resource.
- id string
The provider-assigned unique ID for this managed resource.
- id str
The provider-assigned unique ID for this managed resource.
- id String
The provider-assigned unique ID for this managed resource.
Look up Existing Job Resource
Get an existing Job resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: JobState, opts?: CustomResourceOptions): Job
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
batch_pool_id: Optional[str] = None,
common_environment_properties: Optional[Mapping[str, str]] = None,
display_name: Optional[str] = None,
name: Optional[str] = None,
priority: Optional[int] = None,
task_retry_maximum: Optional[int] = None) -> Job
func GetJob(ctx *Context, name string, id IDInput, state *JobState, opts ...ResourceOption) (*Job, error)
public static Job Get(string name, Input<string> id, JobState? state, CustomResourceOptions? opts = null)
public static Job get(String name, Output<String> id, JobState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Batch
Pool stringId The ID of the Batch Pool. Changing this forces a new Batch Job to be created.
- Common
Environment Dictionary<string, string>Properties Specifies a map of common environment settings applied to this Batch Job. Changing this forces a new Batch Job to be created.
- Display
Name string The display name of this Batch Job. Changing this forces a new Batch Job to be created.
- Name string
The name which should be used for this Batch Job. Changing this forces a new Batch Job to be created.
- Priority int
The priority of this Batch Job, possible values can range from -1000 (lowest) to 1000 (highest). Defaults to
0
.- Task
Retry intMaximum The number of retries to each Batch Task belongs to this Batch Job. If this is set to
0
, the Batch service does not retry Tasks. If this is set to-1
, the Batch service retries Batch Tasks without limit. Default value is0
.
- Batch
Pool stringId The ID of the Batch Pool. Changing this forces a new Batch Job to be created.
- Common
Environment map[string]stringProperties Specifies a map of common environment settings applied to this Batch Job. Changing this forces a new Batch Job to be created.
- Display
Name string The display name of this Batch Job. Changing this forces a new Batch Job to be created.
- Name string
The name which should be used for this Batch Job. Changing this forces a new Batch Job to be created.
- Priority int
The priority of this Batch Job, possible values can range from -1000 (lowest) to 1000 (highest). Defaults to
0
.- Task
Retry intMaximum The number of retries to each Batch Task belongs to this Batch Job. If this is set to
0
, the Batch service does not retry Tasks. If this is set to-1
, the Batch service retries Batch Tasks without limit. Default value is0
.
- batch
Pool StringId The ID of the Batch Pool. Changing this forces a new Batch Job to be created.
- common
Environment Map<String,String>Properties Specifies a map of common environment settings applied to this Batch Job. Changing this forces a new Batch Job to be created.
- display
Name String The display name of this Batch Job. Changing this forces a new Batch Job to be created.
- name String
The name which should be used for this Batch Job. Changing this forces a new Batch Job to be created.
- priority Integer
The priority of this Batch Job, possible values can range from -1000 (lowest) to 1000 (highest). Defaults to
0
.- task
Retry IntegerMaximum The number of retries to each Batch Task belongs to this Batch Job. If this is set to
0
, the Batch service does not retry Tasks. If this is set to-1
, the Batch service retries Batch Tasks without limit. Default value is0
.
- batch
Pool stringId The ID of the Batch Pool. Changing this forces a new Batch Job to be created.
- common
Environment {[key: string]: string}Properties Specifies a map of common environment settings applied to this Batch Job. Changing this forces a new Batch Job to be created.
- display
Name string The display name of this Batch Job. Changing this forces a new Batch Job to be created.
- name string
The name which should be used for this Batch Job. Changing this forces a new Batch Job to be created.
- priority number
The priority of this Batch Job, possible values can range from -1000 (lowest) to 1000 (highest). Defaults to
0
.- task
Retry numberMaximum The number of retries to each Batch Task belongs to this Batch Job. If this is set to
0
, the Batch service does not retry Tasks. If this is set to-1
, the Batch service retries Batch Tasks without limit. Default value is0
.
- batch_
pool_ strid The ID of the Batch Pool. Changing this forces a new Batch Job to be created.
- common_
environment_ Mapping[str, str]properties Specifies a map of common environment settings applied to this Batch Job. Changing this forces a new Batch Job to be created.
- display_
name str The display name of this Batch Job. Changing this forces a new Batch Job to be created.
- name str
The name which should be used for this Batch Job. Changing this forces a new Batch Job to be created.
- priority int
The priority of this Batch Job, possible values can range from -1000 (lowest) to 1000 (highest). Defaults to
0
.- task_
retry_ intmaximum The number of retries to each Batch Task belongs to this Batch Job. If this is set to
0
, the Batch service does not retry Tasks. If this is set to-1
, the Batch service retries Batch Tasks without limit. Default value is0
.
- batch
Pool StringId The ID of the Batch Pool. Changing this forces a new Batch Job to be created.
- common
Environment Map<String>Properties Specifies a map of common environment settings applied to this Batch Job. Changing this forces a new Batch Job to be created.
- display
Name String The display name of this Batch Job. Changing this forces a new Batch Job to be created.
- name String
The name which should be used for this Batch Job. Changing this forces a new Batch Job to be created.
- priority Number
The priority of this Batch Job, possible values can range from -1000 (lowest) to 1000 (highest). Defaults to
0
.- task
Retry NumberMaximum The number of retries to each Batch Task belongs to this Batch Job. If this is set to
0
, the Batch service does not retry Tasks. If this is set to-1
, the Batch service retries Batch Tasks without limit. Default value is0
.
Import
Batch Jobs can be imported using the resource id
, e.g.
$ pulumi import azure:batch/job:Job example /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Batch/batchAccounts/account1/pools/pool1/jobs/job1
Package Details
- Repository
- Azure Classic pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
azurerm
Terraform Provider.