{
  "$id": "https://community-tc.services.mozilla.com/schemas/queue/v1/task.json#",
  "$schema": "https://community-tc.services.mozilla.com/schemas/common/metaschema.json#",
  "additionalProperties": false,
  "description": "Definition of a task that can be scheduled\n",
  "properties": {
    "created": {
      "description": "Creation time of task",
      "format": "date-time",
      "title": "Created",
      "type": "string"
    },
    "deadline": {
      "description": "Deadline of the task, by which this task must be complete. `pending` and\n`running` runs are resolved as **exception** if not resolved by other means\nbefore the deadline. After the deadline, a task is immutable. Note,\ndeadline cannot be more than 5 days into the future\n",
      "format": "date-time",
      "title": "Deadline",
      "type": "string"
    },
    "dependencies": {
      "default": [],
      "description": "List of dependent tasks. These must either be _completed_ or _resolved_\nbefore this task is scheduled. See `requires` for semantics.\nThere can be up to `max-task-dependencies` dependencies, but this value can be\noverridden per-deployment to allow lower values.\n",
      "items": {
        "description": "The `taskId` of a task that must be resolved before this task is\nscheduled.\n",
        "pattern": "^[A-Za-z0-9_-]{8}[Q-T][A-Za-z0-9_-][CGKOSWaeimquy26-][A-Za-z0-9_-]{10}[AQgw]$",
        "title": "Task Dependency",
        "type": "string"
      },
      "maxItems": 10000,
      "title": "Task Dependencies",
      "type": "array",
      "uniqueItems": true
    },
    "expires": {
      "description": "Task expiration, time at which task definition and status is deleted.\nNotice that all artifacts for the task must have an expiration that is no\nlater than this. If this property isn't it will be set to `deadline`\nplus one year (this default may change).\n",
      "format": "date-time",
      "title": "Expiration",
      "type": "string"
    },
    "extra": {
      "default": {},
      "description": "Object with properties that can hold any kind of extra data that should be\nassociated with the task. This can be data for the task which doesn't\nfit into `payload`, or it can supplementary data for use in services\nlistening for events from this task. For example this could be details to\ndisplay on dashboard, or information for indexing the task. Please, try\nto put all related information under one property, so `extra` data keys\ndon't conflict.  **Warning**, do not stuff large data-sets in here --\ntask definitions should not take-up multiple MiBs.\n",
      "title": "Extra Data",
      "type": "object"
    },
    "metadata": {
      "$ref": "task-metadata.json#"
    },
    "payload": {
      "description": "Task-specific payload following worker-specific format.\nRefer to the documentation for the worker implementing\n`<provisionerId>/<workerType>` for details.\n",
      "title": "Task Payload",
      "type": "object"
    },
    "priority": {
      "default": "lowest",
      "description": "Priority of task. This defaults to `lowest` and the scope\n`queue:create-task:<priority>/<provisionerId>/<workerType>` is required\nto define a task with `<priority>`. The `normal` priority is treated as\n`lowest`.\n",
      "enum": [
        "highest",
        "very-high",
        "high",
        "medium",
        "low",
        "very-low",
        "lowest",
        "normal"
      ],
      "title": "Task Priority",
      "type": "string"
    },
    "projectId": {
      "default": "none",
      "description": "The name for the \"project\" with which this task is associated.  This\nvalue can be used to control permission to manipulate tasks as well as\nfor usage reporting.  Project ids are typically simple identifiers,\noptionally in a hierarchical namespace separated by `/` characters.\nThis value defaults to `none`.\n",
      "maxLength": 500,
      "minLength": 1,
      "pattern": "^([a-zA-Z0-9._/-]*)$",
      "title": "Project Identifier",
      "type": "string"
    },
    "provisionerId": {
      "description": "Unique identifier for a provisioner, that can supply specified\n`workerType`. Deprecation is planned for this property as it\nwill be replaced, together with `workerType`, by the new\nidentifier `taskQueueId`.\n",
      "pattern": "^[a-zA-Z0-9-_]{1,38}$",
      "title": "Provisioner Id",
      "type": "string"
    },
    "requires": {
      "default": "all-completed",
      "description": "The tasks relation to its dependencies. This property specifies the\nsemantics of the `task.dependencies` property.\nIf `all-completed` is given the task will be scheduled when all\ndependencies are resolved _completed_ (successful resolution).\nIf `all-resolved` is given the task will be scheduled when all dependencies\nhave been resolved, regardless of what their resolution is.\n",
      "enum": [
        "all-completed",
        "all-resolved"
      ],
      "title": "Dependency Requirement Semantics",
      "type": "string"
    },
    "retries": {
      "default": 5,
      "description": "Number of times to retry the task in case of infrastructure issues.\nAn _infrastructure issue_ is a worker node that crashes or is shutdown,\nthese events are to be expected.\n",
      "maximum": 49,
      "minimum": 0,
      "title": "Retries",
      "type": "integer"
    },
    "routes": {
      "default": [],
      "description": "List of task-specific routes. Pulse messages about the task will be CC'ed to\n`route.<value>` for each `<value>` in this array.\n\nThis array has a maximum size due to a limitation of the AMQP protocol,\nover which Pulse runs.  All routes must fit in the same \"frame\" of this\nprotocol, and the frames have a fixed maximum size (typically 128k).\n",
      "items": {
        "description": "A task specific route.\n",
        "maxLength": 249,
        "minLength": 1,
        "title": "Task Specific Route",
        "type": "string"
      },
      "maxItems": 64,
      "title": "Task Specific Routes",
      "type": "array",
      "uniqueItems": true
    },
    "schedulerId": {
      "default": "-",
      "description": "All tasks in a task group must have the same `schedulerId`. This is used for several purposes:\n\n* it can represent the entity that created the task;\n* it can limit addition of new tasks to a task group: the caller of\n    `createTask` must have a scope related to the `schedulerId` of the task\n    group;\n* it controls who can manipulate tasks, again by requiring\n    `schedulerId`-related scopes; and\n* it appears in the routing key for Pulse messages about the task.\n",
      "maxLength": 38,
      "minLength": 1,
      "pattern": "^([a-zA-Z0-9-_]*)$",
      "title": "Scheduler Identifier",
      "type": "string"
    },
    "scopes": {
      "description": "List of scopes that the task is authorized to use during its execution.\n",
      "items": {
        "description": "A single scope. A scope must be composed of\nprintable ASCII characters and spaces.  Scopes ending in more than\none `*` character are forbidden.\n",
        "pattern": "^[ -~]*$",
        "title": "Scope",
        "type": "string"
      },
      "title": "Scopes",
      "type": "array",
      "uniqueItems": false
    },
    "tags": {
      "additionalProperties": {
        "maxLength": 4096,
        "type": "string"
      },
      "default": {},
      "description": "Arbitrary key-value tags (only strings limited to 4k). These can be used\nto attach informal metadata to a task. Use this for informal tags that\ntasks can be classified by. You can also think of strings here as\ncandidates for formal metadata. Something like\n`purpose: 'build' || 'test'` is a good example.\n",
      "title": "Tags",
      "type": "object"
    },
    "taskGroupId": {
      "description": "Identifier for a group of tasks scheduled together with this task.\nGenerally, all tasks related to a single event such as a version-control\npush or a nightly build have the same `taskGroupId`.  This property\ndefaults to `taskId` if it isn't specified.  Tasks with `taskId` equal to\nthe `taskGroupId` are, [by convention](/docs/manual/using/task-graph),\ndecision tasks.\n",
      "pattern": "^[A-Za-z0-9_-]{8}[Q-T][A-Za-z0-9_-][CGKOSWaeimquy26-][A-Za-z0-9_-]{10}[AQgw]$",
      "title": "Task-Group Identifier",
      "type": "string"
    },
    "taskQueueId": {
      "description": "Unique identifier for a task queue\n",
      "pattern": "^[a-zA-Z0-9-_]{1,38}/[a-z]([-a-z0-9]{0,36}[a-z0-9])?$",
      "title": "Task Queue Id",
      "type": "string"
    },
    "workerType": {
      "description": "Unique identifier for a worker-type within a specific\nprovisioner. Deprecation is planned for this property as it will\nbe replaced, together with `provisionerId`, by the new\nidentifier `taskQueueId`.\n",
      "pattern": "^[a-z]([-a-z0-9]{0,36}[a-z0-9])?$",
      "title": "Worker Type",
      "type": "string"
    }
  },
  "required": [
    "provisionerId",
    "workerType",
    "taskQueueId",
    "schedulerId",
    "taskGroupId",
    "dependencies",
    "requires",
    "routes",
    "priority",
    "retries",
    "created",
    "deadline",
    "scopes",
    "payload",
    "metadata",
    "tags",
    "extra"
  ],
  "title": "Task Definition Response",
  "type": "object"
}