About This Page
This page is part of the Azure documentation. It contains code examples and configuration instructions for working with Azure services.
Bias Analysis
Bias Types:
⚠️
missing_linux_example
⚠️
windows_tools
⚠️
powershell_heavy
⚠️
windows_first
Summary:
The documentation page exhibits a strong Windows bias. All code examples use Windows command-line syntax (cmd.exe /c echo ...), and there are no Linux or cross-platform shell examples. The documentation refers exclusively to Windows tools (cmd.exe), and does not mention Linux shells (bash/sh) or provide equivalent Linux command examples. The structure and examples assume a Windows environment by default, with no guidance for Linux users.
Recommendations:
- For every code example using Windows command-line (cmd.exe), provide an equivalent Linux shell (bash/sh) example, e.g., 'bash -c "echo Flowers"'.
- Explicitly mention that Azure Batch supports both Windows and Linux compute nodes, and clarify any differences in task command line syntax.
- Add a section or note explaining how to adapt the examples for Linux pools, including differences in shell invocation and exit code handling if applicable.
- Avoid using Windows tools exclusively in examples; use cross-platform commands where possible (e.g., 'echo' is available on both platforms, but the shell invocation differs).
- Where possible, provide side-by-side or tabbed code samples for Windows and Linux to improve parity and accessibility for all users.
Create pull request
Flagged Code Snippets
// Task 'Flowers' depends on completion of both 'Rain' and 'Sun'
// before it is run.
new CloudTask("Flowers", "cmd.exe /c echo Flowers")
{
DependsOn = TaskDependencies.OnIds("Rain", "Sun")
},
// Task 'taskA' doesn't depend on any other tasks
new CloudTask("taskA", "cmd.exe /c echo taskA"),
// Task 'taskB' depends on completion of task 'taskA'
new CloudTask("taskB", "cmd.exe /c echo taskB")
{
DependsOn = TaskDependencies.OnId("taskA")
},
// 'Rain' and 'Sun' don't depend on any other tasks
new CloudTask("Rain", "cmd.exe /c echo Rain"),
new CloudTask("Sun", "cmd.exe /c echo Sun"),
// Task 'Flowers' depends on completion of both 'Rain' and 'Sun'
// before it is run.
new CloudTask("Flowers", "cmd.exe /c echo Flowers")
{
DependsOn = TaskDependencies.OnIds("Rain", "Sun")
},
// Tasks 1, 2, and 3 don't depend on any other tasks. Because
// we will be using them for a task range dependency, we must
// specify string representations of integers as their ids.
new CloudTask("1", "cmd.exe /c echo 1"),
new CloudTask("2", "cmd.exe /c echo 2"),
new CloudTask("3", "cmd.exe /c echo 3"),
// Task 4 depends on a range of tasks, 1 through 3
new CloudTask("4", "cmd.exe /c echo 4")
{
// To use a range of tasks, their ids must be integer values.
// Note that we pass integers as parameters to TaskIdRange,
// but their ids (above) are string representations of the ids.
DependsOn = TaskDependencies.OnIdRange(1, 3)
},
// Task A is the parent task.
new CloudTask("A", "cmd.exe /c echo A")
{
// Specify exit conditions for task A and their dependency actions.
ExitConditions = new ExitConditions
{
// If task A exits with a pre-processing error, block any downstream tasks (in this example, task B).
PreProcessingError = new ExitOptions
{
DependencyAction = DependencyAction.Block
},
// If task A exits with the specified error codes, block any downstream tasks (in this example, task B).
ExitCodes = new List<ExitCodeMapping>
{
new ExitCodeMapping(10, new ExitOptions() { DependencyAction = DependencyAction.Block }),
new ExitCodeMapping(20, new ExitOptions() { DependencyAction = DependencyAction.Block })
},
// If task A succeeds or fails with any other error, any downstream tasks become eligible to run
// (in this example, task B).
Default = new ExitOptions
{
DependencyAction = DependencyAction.Satisfy
}
}
},
// Task B depends on task A. Whether it becomes eligible to run depends on how task A exits.
new CloudTask("B", "cmd.exe /c echo B")
{
DependsOn = TaskDependencies.OnId("A")
},