# Job templates

> Source: https://docs.clonepartner.com/reference/job-templates/

A job template composes reusable tasks into a directed acyclic graph. Creating a job resolves template arguments, snapshots task definitions, binds stored connectors, creates dashboard instances, and seeds job configuration.

## Structure

```yaml
name: ticket-migration
description: Migrate tickets and attachments

connectors:
  source:
    type: truto
  destination:
    type: postgres
  mapping_db:
    type: sqlite

arguments:
  account_id:
    type: string
    required: true

job_config:
  migration:
    type: form
    title: Migration settings
    fields:
      - key: dry_run
        label: Preview only
        type: boolean
        default: true

tasks:
  prepare:
    task: prepare-destination
    connector_mapping:
      destination: destination

  tickets:
    task: migrate-tickets
    depends_on: [prepare]
    connector_mapping:
      source: source
      destination: destination
      mapping_db: mapping_db
    arguments:
      integrated_account_id: ${account_id}

on_failure: pause
```

## Top-level fields

- `name` — stable template name.
- `description` — user-facing purpose.
- `connectors` — template connector names and types.
- `arguments` — create-time values substituted into the snapshot.
- `job_config` — runtime-editable schema copied into each job.
- `tasks` — task nodes keyed by job task key.
- `on_failure` — `pause` (default), `abort`, or `continue`.

Dashboard templates are associated with the job template as separate records and are instantiated with the job.

## Task node fields

- `task` — referenced task definition name.
- `depends_on` — array of upstream task keys.
- `connector_mapping` — task slot to template connector name.
- `arguments` — task runtime arguments.
- `description` — optional node-specific description.
- `type` — optional `command` or `validation` behavior; omit for a regular task.

Task keys must be unique. Dependencies must exist and cannot form a cycle.

## Failure behavior

Job execution schedules tasks when their dependencies satisfy the graph rules. A failed dependency can prevent downstream work. `on_failure` can pause for operator intervention, abort the graph, or allow independent work to continue.

Stopping a job does not roll back completed external writes.

## Arguments and configuration

Use:

- [template arguments](/guides/template-arguments) for values fixed at job creation;
- [job configuration](/guides/job-configuration) for values editable between runs;
- task-node arguments for binding the first two into a particular task.

## Targeted runs

A run can target selected task keys. Dependencies are included by default. `skip_deps: true` is an operator assertion that required upstream state already exists.

## Snapshot behavior

Creating a job captures the current template and task versions. Starting a run captures the current job configuration. Later edits do not mutate historical jobs or runs.

An upgrade should compare resolved snapshots, not only top-level template version names.

## Validation

Template validation checks:

- YAML shape;
- referenced tasks;
- connector type compatibility;
- connector slot mappings;
- missing and cyclic dependencies;
- argument definitions and substitutions;
- task override targets;
- dashboard definitions where applicable.

It cannot validate target credentials or external side effects.

See [Override a task in a job template](/guides/job-task-overrides) and [Job templates and jobs](/ui/job-templates-and-jobs).
