Task Definition

A Task Definition describes the actions for the Task Runner and Evaluator to use when processing a Task.

The major components are the conditions, result, and runner.

Example Task Definition

{
  "conditions": [
    {
      "action": "map",
      "condition": "exist(dataset(hpcp('zdpuAxC1mnb6USNY8psFA2fowsDrngsFNefMx42TX9ZDjLvVr/split/results'))) && !exist(dataset(hpcp('zdpuAxC1mnb6USNY8psFA2fowsDrngsFNefMx42TX9ZDjLvVr/map/results')))",
      "name": "Create Map tasks",
      "taskDefinition": {
        "/": "zdpuAvKf8Bjgpjdd1BwdBMWrtGLn1PhmCkCoSXKUAv2NmxgYL"
      }
    }
  ],
  "constraints": [
    {
      "type": "os",
      "value": "linux"
    },
    {
      "type": "arch",
      "value": "amd64"
    }
  ],
  "result": {
    "action": "set",
    "destination": {
      "dataset": {
        "/": "zdpuAxC1mnb6USNY8psFA2fowsDrngsFNefMx42TX9ZDjLvVr"
      },
      "path": "split/results"
    }
  },
  "runner": {
    "manifest": {
      "*": {
        "image": "computes/fibonacci-sum-split:latest"
      }
    },
    "type": "docker-json-runner"
  }
}

Conditions

Any time the Dataset changes, the conditions will be evaluated. When a condition is successfully met, a new Task will be enqueued. Due to the immutable, content-addressable nature of IPFS, if a condition is successfully evaluated multiple times across multiple nodes, the resulting action is idempotent.

The conditions syntax is based on govaluate with some custom functions for accessing Hash Pointer Collaboration Protocol and a Grow Only Hash Object.

Constraints

A Constraint defines limitations on where a task can be run. The constraints will be checked before a task is taken by a Computes node.

Result

The Dataset is a Grow Only Hash Object that contains the output of the Task Runner. It can be used as the input for future tasks.

Runner

The Task Runner will interpret the runner type and manifest to kick off the appropriate binary on the Computes node.