Azure Batch Job

The Batch Job job type creates an Azure Batch Job and a single Task inside it per Polysync execution, then polls the Task to completion. The discovery artefact is an existing Batch Job template (used to clone defaults such as pool, container image, command line) — Polysync stores its Job ID in the External Id.

This job type is supported on the Azure Batch platform.

Required job fields

  • External Id — the source Batch Job ID (used as the template for cloned per-execution Jobs).
  • Job TypeBatch Job (set automatically on import).

Job discovery

GET https://{batchAccountUrl}/jobs?$select=id,displayName,state (paginated via nextLink / $skiptoken).

Parameter handling

Polysync forwards Input + Input&Output parameter values as environmentSettings on the new Task:

{
  "id": "<task-id>",
  "commandLine": "<task-command>",
  "environmentSettings": [
    { "name": "<param-1>", "value": "<value-1>" },
    { "name": "<param-2>", "value": "<value-2>" }
  ],
  "containerSettings": {
    "imageName": "<image>",
    "containerRunOptions": "<options>"
  }
}
Direction Sent as environmentSettings Updated from response
Input
Output (not supported)
Input&Output (not supported)

Values are strings; the Task is responsible for parsing typed values from %NAME% env vars.

Output parameters are not supported. Persist task results to Azure Storage / Application Insights and reference them downstream.

Execution flow

  1. Polysync creates a new Batch Job (POST /jobs) with:

    {
      "id": "<polysync-generated-job-id>",
      "displayName": "<polysync-name>",
      "poolInfo": { "poolId": "<source-job-pool>" },
      "onAllTasksComplete": "terminateJob"
    }
    
  2. A single Task is added via POST /jobs/{jobId}/tasks using the payload shown above.

  3. The composite RunId is "{jobId}/{taskId}".

  4. Status is polled by reading the Task with GET /jobs/{jobId}/tasks/{taskId} and decoded:

    Batch task state Polysync status
    active / preparing Starting
    running Running
    completed with executionInfo.exitCode == 0 Success
    completed with executionInfo.exitCode != 0 Failed
    (other) Unknown
  5. Cancel is supported via POST /jobs/{jobId}/tasks/{taskId}/terminate followed by POST /jobs/{jobId}/terminate for a clean teardown.

Monitor URL

https://portal.azure.com/#resource/subscriptions/{subId}/resourceGroups/{rg}
  /providers/Microsoft.Batch/batchAccounts/{account}/jobs/{jobId}

Best practices

  • Use a dedicated template Batch Job per Polysync Job — keep pool / container / command settings on it so cloned Jobs inherit them.
  • Set Task constraints.maxWallClockTime on the template to bound run time and avoid stuck polls.
  • For sensitive values, use Polysync parameters with the Secret data type — they're still passed as env vars but won't appear in Polysync UI logs in plaintext.

Troubleshooting

  • Task stays in preparing forever — the Pool has no available compute nodes (autoscale formula or quota). Inspect the Pool in the Azure portal.
  • exitCode != 0 but no visible error — Batch surfaces stderr in executionInfo.failureInfo.message; check the monitor link for the detail.
  • PoolNotFound — the source Job's poolInfo.poolId no longer exists. Update the template Batch Job's pool.