Skip to content

Commit b5dd521

Browse files
committed
some changes
1 parent 81f2016 commit b5dd521

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

articles/batch/batch-job-prep-release.md

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,19 @@ ms.custom: "seodec18, devx-track-csharp"
99
---
1010
# Job preparation and release tasks on Batch compute nodes
1111

12-
An Azure Batch job often requires setup before its tasks are executed, and post-job maintenance when its tasks are completed. For example, you might need to download common task input data to your compute nodes, or upload task output data to Azure Storage after the job completes. You can use *job preparation* and *job release* tasks to do these operations.
12+
An Azure Batch job often requires setup before its tasks are executed, and post-job maintenance when its tasks are completed. For example, you might need to download common task input data to your compute nodes, or upload task output data to Azure Storage after the job completes. You can use *job preparation* and *job release* tasks for these operations.
1313

14-
- A job preparation task runs before a job's tasks run, on all compute nodes scheduled to run at least one task.
14+
- A job preparation task runs before a job's tasks, on all compute nodes scheduled to run at least one task.
1515
- A job release task runs once the job is completed, on each node in the pool that executed at least one task.
1616

17-
As with other Batch tasks, you can specify a command line to invoke when a job preparation or release task runs. Job preparation and release tasks offer familiar Batch task features such as [resource file download](/dotnet/api/microsoft.azure.batch.jobpreparationtask.resourcefiles), elevated execution, custom environment variables, maximum execution duration, retry count, and file retention time.
17+
As with other Batch tasks, you can specify a command line to invoke when a job preparation or release task runs. Job preparation and release tasks offer familiar Batch task features such as:
18+
19+
- [Resource file download](/dotnet/api/microsoft.azure.batch.jobpreparationtask.resourcefiles).
20+
- Elevated execution.
21+
- Custom environment variables.
22+
- Maximum execution duration.
23+
- Retry count.
24+
- File retention time.
1825

1926
This article shows how to use the [JobPreparationTask](/dotnet/api/microsoft.azure.batch.jobpreparationtask) and [JobReleaseTask](/dotnet/api/microsoft.azure.batch.jobreleasetask) classes in the [Batch .NET](/dotnet/api/microsoft.azure.batch) library.
2027

@@ -25,17 +32,17 @@ This article shows how to use the [JobPreparationTask](/dotnet/api/microsoft.azu
2532

2633
Job preparation and job release tasks are a good fit for the following situations:
2734

28-
- **Download common task data**. Batch jobs often require a common set of data as input for a job's tasks. Use a job preparation task to download this data to each node before the execution of the job's other tasks.
35+
- **Download common task data**. Batch jobs often require a common set of data as input for a job's tasks. You can use a job preparation task to download this data to each node before the execution of the job's other tasks.
2936

3037
For example, in daily risk analysis calculations, market data is job-specific yet common to all tasks in the job. You can use a job preparation task to download this market data, which is often several gigabytes in size, to each compute node so that any task that runs on the node can use it.
3138

32-
- **Job and task output deletion**. In a shared pool environment where a pool's compute nodes aren't decommissioned between jobs, you might need to delete job data between runs. For example, you might need to conserve disk space on the nodes, or satisfy your organization's security policies. You can use a job release task to delete data that a job preparation task downloaded or that task execution generated.
39+
- **Job and task output deletion**. In a shared pool environment, where a pool's compute nodes aren't decommissioned between jobs, you might need to delete job data between runs. For example, you might need to conserve disk space on the nodes, or satisfy your organization's security policies. You can use a job release task to delete data that a job preparation task downloaded or that task execution generated.
3340

3441
- **Log retention**. You might want to keep a copy of log files that your tasks generate, or crash dump files that failed applications generate. You can use a job release task to compress and upload this data to an [Azure Storage account](accounts.md#azure-storage-accounts).
3542

3643
## Job preparation task
3744

38-
Before running job tasks, Batch runs the job preparation task on each compute node scheduled to run a task. By default, Batch waits for the job preparation task to complete before running scheduled job tasks, but you can configure it not to wait.
45+
Before it runs job tasks, Batch runs the job preparation task on each compute node scheduled to run a task. By default, Batch waits for the job preparation task to complete before running scheduled job tasks, but you can configure it not to wait.
3946

4047
If the node restarts, the job preparation task runs again, but you can also disable this behavior. If you have a job with a job preparation task and a job manager task, the job preparation task runs before the job manager task and before all other tasks. The job preparation task always runs first.
4148

@@ -96,18 +103,18 @@ await myBatchClient.JobOperations.TerminateJobAsync("JobPrepReleaseSampleJob");
96103

97104
## Code sample on GitHub
98105

99-
To see job preparation and release tasks in action, build the [JobPrepRelease](https://github.com/Azure-Samples/azure-batch-samples/tree/master/CSharp/ArticleProjects/JobPrepRelease) sample project on GitHub. This console application does the following:
106+
To see job preparation and release tasks in action, build the [JobPrepRelease](https://github.com/Azure-Samples/azure-batch-samples/tree/master/CSharp/ArticleProjects/JobPrepRelease) sample project from GitHub. This console application takes the following actions:
100107

101108
1. Creates a pool with two nodes.
102109
1. Creates a job with job preparation, release, and standard tasks.
103110
1. Runs the job preparation task, which first writes the node ID to a text file in a node's *shared* directory.
104111
1. Runs a task on each node that writes its task ID to the same text file.
105112
1. Once all tasks are completed or the timeout is reached, prints the contents of each node's text file to the console.
106-
1. When the job is completed, runs the job release task to delete the file from the node.
113+
1. Runs the job release task to delete the file from the node when the job is completed.
107114
1. Prints the exit codes of the job preparation and release tasks for each node they ran on.
108115
1. Pauses execution to allow confirmation of job and/or pool deletion.
109116

110-
Output from the sample application is similar to the following:
117+
Output from the sample application is similar to the following example:
111118

112119
```output
113120
Attempting to create pool: JobPrepReleaseSamplePool
@@ -153,11 +160,11 @@ Sample complete, hit ENTER to exit...
153160
```
154161

155162
> [!NOTE]
156-
> Because the variable creation and start time of nodes in a new pool means some nodes are ready for tasks before others, you might see different output. Specifically, because the tasks complete quickly, one of the pool's nodes might run all of the job's tasks. If this occurs, you sees that the job preparation and release tasks don't exist for the node that ran no tasks.
163+
> Because the variable creation and start time of nodes in a new pool means some nodes are ready for tasks before others, you might see different output. Specifically, because the tasks complete quickly, one of the pool's nodes might run all of the job's tasks. If this occurs, the job preparation and release tasks don't exist for the node that ran no tasks.
157164
158165
## View job preparation and release tasks in the Azure portal
159166

160-
You can use the [Azure portal](https://portal.azure.com) to view Batch job properties and tasks, including preparation tasks and release tasks. Navigate to the job page after your tasks have completed, but before deleting your job and pool.
167+
You can use the [Azure portal](https://portal.azure.com) to view Batch job properties and tasks, including job preparation tasks and release tasks. Navigate to the job page after your tasks have completed, but before deleting your job and pool.
161168

162169
The following screenshot shows the **JobPrepReleaseSampleJob** page after you run the sample application. Because the job has preparation tasks, you can select **Preparation tasks** in the left navigation on the job page to see their properties. You can also download the shared text file that the job tasks modify by selecting **Tasks** in the left navigation.
163170

0 commit comments

Comments
 (0)