Skip to main content

Creating a Job

You may create a Job by sending a POST request to the /v1/jobs endpoint. This request allows you to specify the desired resources of the Node that performs the work, as well as the parameters for the container that runs the Job.

If you need to connect to the Node container, you may also pass an SSH public key in the parameters object. This SSH key may be used to authenticate your connection to the Node.

// POST /v1/jobs

{
"cpu_count": 1, // The desired number of CPU cores
"gpu_count": 1, // The desired number of GPU devices
"min_ram_gb": 16, // The minimum amount of RAM in GB
"min_storage_gb": 32, // The minimum amount of available storage in GB
"min_vram_gb": 8, // The minimum amount of VRAM in GB
"parameters": {
"type": "docker",
"parameters": {
"image": "otoy/zernet-base",
"tag": "latest",
"sshkey": "ssh-rsa ... user@host",
"allowed_ips": ["127.0.0.1/32"]
}
},
"title": "My Job" // The title of the job
}
// Response

{
//...other fields,
"object": "job",
"status": "ASSIGNED",
"title": "string",
"uuid": "string"
}

Query for Job Runs

Once your Job has been assigned, you may query for the Job Runs that are associated with it. You can do this by sending a GET request to the /v1/jobs-runs endpoint with ?filter[job_uuid]=<job_uuid> as a query string.

GET /v1/jobs-runs?filter[job_uuid]=<job_uuid>
// Response

{
"data": [
{
"started_at_ms": 0,
"ended_at_ms": 0,
"duration_ms": 0,
"node_urls": [
// An array of URL parameters that can be used to connect to the Node running the job
{
"description": "ssh",
"hostname": "127.0.0.1",
"port": 22,
"protocol": "tcp"
}
],
"object": "job_run",
"status": "ASSIGNED",
"uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
],
"limit": 0,
"page": 0,
"total": 0
}