Skip to main content
GET
/
v1
/
training
/
jobs
/
{training_job_id}
/
queue_context
cURL
curl --request GET \
--url https://api.baseten.co/v1/training/jobs/{training_job_id}/queue_context \
--header "Authorization: Bearer $BASETEN_API_KEY"
import requests
import os
API_KEY = os.environ.get("BASETEN_API_KEY", "<YOUR_API_KEY>")
url = "https://api.baseten.co/v1/training/jobs/{training_job_id}/queue_context"

headers = {"Authorization": f"Bearer {API_KEY}"}

response = requests.request(
"GET",
url,
headers=headers,
json={}
)

print(response.text)
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch('https://api.baseten.co/v1/training/jobs/{training_job_id}/queue_context', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.baseten.co/v1/training/jobs/{training_job_id}/queue_context",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"net/http"
"io"
)

func main() {

url := "https://api.baseten.co/v1/training/jobs/{training_job_id}/queue_context"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("Authorization", "Bearer <token>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://api.baseten.co/v1/training/jobs/{training_job_id}/queue_context")
.header("Authorization", "Bearer <token>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.baseten.co/v1/training/jobs/{training_job_id}/queue_context")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
{
  "target_job_id": "<string>",
  "gpu_type": "<string>",
  "requested_gpus": 123,
  "submitted_at": "2023-11-07T05:31:56Z",
  "active_at_submit": [
    {
      "training_job_id": "<string>",
      "instance_type_name": "<string>",
      "total_gpus": 123,
      "workload_plane_name": "<string>",
      "status_at_submit": "<string>",
      "status_set_at": "2023-11-07T05:31:56Z",
      "training_job_name": "<string>"
    }
  ],
  "pending_ahead_at_submit": [
    {
      "training_job_id": "<string>",
      "instance_type_name": "<string>",
      "requested_gpus": 123,
      "priority": 123,
      "submitted_at": "2023-11-07T05:31:56Z",
      "training_job_name": "<string>"
    }
  ],
  "events": [
    {
      "training_job_id": "<string>",
      "status": "<string>",
      "created": "2023-11-07T05:31:56Z",
      "training_job_name": "<string>",
      "event_message": "<string>",
      "exit_code": 123
    }
  ],
  "events_window_end": "2023-11-07T05:31:56Z",
  "target_job_name": "<string>",
  "released_at": "2023-11-07T05:31:56Z",
  "pending_seconds": 123,
  "org_capacity": {
    "gpu_type": "<string>",
    "max_gpus": 123,
    "last_modified": "2023-11-07T05:31:56Z",
    "min_gpus": 123
  },
  "team_capacity": {
    "gpu_type": "<string>",
    "max_gpus": 123,
    "last_modified": "2023-11-07T05:31:56Z",
    "min_gpus": 123
  }
}

Authorizations

Authorization
string
header
required

Send Authorization: Bearer <api_key>. The legacy Authorization: Api-Key <api_key> scheme is also accepted.

Path Parameters

training_job_id
string
required

Response

200 - application/json

Read-only diagnostic for a training job's PENDING window.

Returns the (org, gpu_type) capacity pool the job was gated by, jobs that were holding GPU capacity in that pool when this job was submitted, and every status event in [submitted_at, released_at] for those jobs (or up to "now" if the target is still PENDING).

target_job_id
string
required

Hashid of the target training job

gpu_type
string
required

GPU type the target requested

requested_gpus
integer
required

GPUs the target requested (gpu_count * effective_node_count)

submitted_at
string<date-time>
required

When the job row was inserted (= API POST time)

active_at_submit
ActiveJobAtSubmitV1 · object[]
required

Jobs in the same (org, gpu_type) pool that were holding capacity at submitted_at

pending_ahead_at_submit
PendingJobAheadAtSubmitV1 · object[]
required

PENDING jobs in the same (org, gpu_type) pool that were ahead of the target in dequeue FIFO order at submitted_at (priority DESC then created ASC). These also block the target's release.

events
QueueEventV1 · object[]
required

Every status event in [submitted_at, events_window_end] for the target job, every job in active_at_submit, and every job in pending_ahead_at_submit, oldest first.

events_window_end
string<date-time>
required

released_at if set, else 'now' (events ongoing)

target_job_name
string | null

Target job's name

released_at
string<date-time> | null

When the job's TRAINING_JOB_CREATED status was set, i.e. the moment it was released from PENDING. None if still PENDING.

pending_seconds
integer | null

released_at - submitted_at in seconds. None if still PENDING.

org_capacity
CapacityAtSubmitV1 · object | null

Org-level cap for (org, gpu_type). None if no cap is configured.

team_capacity
CapacityAtSubmitV1 · object | null

Team-level cap for (team, gpu_type). None if no team cap is configured.