Task

Overview

Task is a computational or other task, which can be performed on computer resourses for a certain time. Task is characterized by the parameters of the resource, which is necessary for its implementation and additional parameters.

Docker is used to perform Customer's tasks in SONM. Task can be packaged in a Docker container and then effectively performed on Supplier's resourses.

Create the task configuration file

The task configuration should be described in the <yourtask>.yaml file, for example task.yaml. To create your task configuration file follow the steps below (the Sonm components (CLI, Node) should be started).

  1. Open cmd.
  2. Create a blank text file in your home directory and name it as <yourtask>.yaml, for example, task.yaml.
  3. Open file to edit: sudo nano task.yaml.
  4. Fill the file with the parameters of your task that described below.
  5. Save and close the file.

Task parameters

Here is an example of the task.yaml file. All parameters have a description. Go to github to see the latest version.

# Docker image settings.
# Required.
container:
  # Image name to start on worker.
  # Required.
  image: httpd@sha256:b5f21641a9d7bbb59dc94fb6a663c43fbf3f56270ce7c7d51801ac74d2e70046
  # Public SSH key providing which opens a capability to login into the
  # container using SSH.
  # Optional.
  ssh_key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDE8axoFpym0R6A6BdgnpKhHB//h0iCiNUuFqwk0jSONvvLseoVpVE5l45tehlxSbaJrTQkgNoGGpEljJXxLQFkyQMZMga+x8uzCxrG39DkPz6sCjefix3x23IlPsU6/LDs/9g6XTLHLhTnmbU4F8qZ7cxa1ikB0IQ+tifUrhvrmXW2QICA0VmUu1Skhxf0BBKPdM0ksFkRaKGa0PmZHlS6h/8MLwI7NLWC/vp+yj7LAbNcOfaDTJGoDUIPHmGyOEA8fTqTrgZqFtLUT2jgYyDH0lL5H4z1Nd5Zy5Ste0pcqXUoomo2fxD4Utz64wtDCYOueTUMeIVmDS441s5dGTQ9"
  # Env variables that will be passed to container on start.
  # Optional.
  env:
    param1: value1
    param2: value2
  # Adds an ability to pull container back.
  # Optional.
  commit_on_stop: true
  # Push the committed image to remote repository (works only if commit_on_stop is set to `true`).
  # Optional.
  push_on_stop: false
  # Volumes settings.
  # Optional.
  volumes:
    # Volume name. It is used as a host entry point when describing mounts in
    # the section below.
    cifs:
      # Volume driver type.
      type: cifs
      # Volume driver specific options.
      options:
        share: samba-host.ru/share
        username: username
        password: password
        security: ntlm
        vers: 3.0
    btfs:
      type: btfs
      options:
        magnet: "magnet:?xt=urn:xxxxxxxxxx"
  # Mount settings describes how to mount volumes specified above in the
  # container.
  # Format is "VOLUME_NAME:PATH:PERM".
  # Optional.
  mounts:
  - cifs:/mnt:rw
  - cifs:/opt:rw
  - btfs:/mnt-btfs:ro
  # Overlay network settings.
  # Optional.
  networks:
  - type: tinc
    subnet: "10.20.30.0/24"

# Custom registry settings.
# Optional.
registry:
  # If not empty, Worker will use given registry to pull an image from.
  # Optional.
  server_address: registry.user.io
  # Registry username.
  # Optional.
  username: name
  # Registry password.
  # Optional.
  password: secret

# Resource limitations and restrictions.
resources:
  # Required GPUs for a task.
  # GPUs are provided exclusively for each task - sharing is forbidden.
  # If a task requires no GPU, specify an empty list.
  gpu:
    hashes: []
    indexes: []

# Additional user-specific information attached to a task.
# Optional.
tag: "some"