Schema
Job Definition Schema
Nosana job definitions outline how tasks execute on Nosana's decentralized GPU network. Jobs are defined via structured JSON objects detailing commands, images, environment, resources, and container configurations.
Field Definitions
πΉ Top-Level Fields
| Field | Type | Required? | Description |
|---|---|---|---|
version | string | β | Job definition schema version (currently "0.1") |
type | "container" | β | Specifies the execution type |
meta | object | β | Job metadata like trigger type and resources |
global | object | β | Defaults applied globally across all operations |
ops | Ops (Array) | β | Ordered operations/tasks for execution |
πΉ Meta
Specifies execution triggers and system resources:
"meta": {
"trigger": "api",
"system_resources": { "required_vram": 18 }
}| Field | Type | Description |
|---|---|---|
trigger | "cli" or "dashboard" | Job origin trigger type |
system_resources | Record<string, string|number> | System-level constraints (e.g., GPU VRAM) |
πΉ Global Defaults
Defaults applied across all operations unless explicitly overridden:
"global": {
"image": "ubuntu",
"gpu": true,
"entrypoint": "/bin/bash",
"env": { "KEY": "value" },
"work_dir": "/workspace"
}| Field | Type | Description |
|---|---|---|
image | string | Default Docker image |
gpu | boolean | Default GPU requirement |
entrypoint | string | string[] | Default Docker entrypoint |
env | object | Default environment variables |
work_dir | string | Default working directory |
πΉ Operations (ops)
Defines tasks within the job:
"ops": [{
"id": "unique-id",
"type": "container/run",
"args": {
"cmd": ["command", "arg1"],
"resources": [],
"authentication": {}
}
}]| Field | Required? | Description |
|---|---|---|
id | β | Unique identifier per operation |
type | β | "container/run" or "container/create-volume" |
args | β | Operation-specific arguments |
πΉ Operation Args
container/run type arguments:
| Field | Type | Required? | Description |
|---|---|---|---|
image | string | β | Docker image, It is recommended to put the URL to the Docker Image. |
cmd | string | string[] | β | Commands to execute |
gpu | boolean | β | GPU requirement |
expose | number | ExposedPort[] | β | Ports exposed |
resources | Resource[] | β | External data sources |
authentication | {docker: DockerAuth} | β | Docker registry authentication |
cmd
The cmd array is important to illustrate, because there are is nuance in how to use it.
If you are familiar with how to use the cmd property in Docker, you should already have an idea of how this property works.
String based CMD
When the first element of the array is the whole command, such as:"gunicorn -w 4 -k uvicorn.workers.UvicornWorker main:app"
Bash will be used as the shell to interpret this command.
Array based CMD
Another option is to put each command and every flag as it's own element in an array:["/bin/sh", "-c", gunicorn", "-w", "4", "-k", "uvicorn.workers.UvicornWorker", "main:app"]
With the array based notation, we are able to specify the shell we want to use.
Note that most often you will need to append -c flag after /bin/sh
You can read more about how to use the cmd property by going to the Docker Documentation.
πΉ Resources
External sources loaded into the container:
S3 resource example:
{
"type": "S3",
"url": "https://storage.example.com/models",
"target": "/data/",
"files": ["model.bin"],
"IAM": {
"ACCESS_KEY_ID": "key",
"SECRET_ACCESS_KEY": "secret"
}
}Hugging Face resource example:
{
"type": "HF",
"repo": "TinyLlama/TinyLlama-1.1B-Chat-v1.0",
"target": "/data-models/"
}You can read more about how resources at Resources
πΉ Docker Authentication
Authenticate to private Docker registries:
"authentication": {
"docker": {
"username": "user",
"password": "pass",
"email": "optional",
"server": "optional registry URL"
}
}Example
Here is a simple example Job Definition of an Pytorch Jupyter Notebook:
{
"version": "0.1",
"type": "container",
"ops": [
{
"type": "container/run",
"id": "Pytorch",
"args": {
"image": "docker.io/nosana/pytorch-jupyter:2.0.0",
"cmd": [
"jupyter",
"lab",
"--ip=0.0.0.0",
"--port=8888",
"--no-browser",
"--allow-root",
"--ServerApp.token=''",
"--ServerApp.password=''"
],
"expose": 8888,
"gpu": true
}
}
],
"meta": {
"trigger": "deployment-manager",
"system_requirements": {
"required_vram": 4
}
}
}