liveBook · Manning

Job id

As explained in Designing AI Systems

A job ID is a unique identifier assigned to an asynchronous workflow execution so clients and services can refer to its job record.

A job ID uniquely identifies an asynchronous execution and lets clients and services refer to its job record. It separates request acceptance from completion: a client can receive the ID immediately instead of holding a connection open while a long-running workflow runs. section 9.1.5 section 9.2.1

For a workflow, the runtime creates a job record, starts the function in the background, and returns HTTP 202 Accepted with the job ID and a status URL. The client polls GET /jobs/{job_id}; the runtime writes progress, results, or errors to the same record. The workflow job begins in processing and ends in completed or failed. section 9.1.5 section 9.2.1

Listing 9.9 Jobs table schema
CREATE TABLE jobs (
    job_id VARCHAR(64) PRIMARY KEY,    #A
    workflow_id VARCHAR(64) NOT NULL,
    status VARCHAR(20) NOT NULL    #B
        DEFAULT 'processing',
    progress_message TEXT,    #C
    input_json TEXT NOT NULL,    #D
    result_json TEXT,    #E
    error TEXT,    #F
    checkpoint_json TEXT,    #G
    assigned_endpoint VARCHAR(256),    #H
    created_at TIMESTAMP NOT NULL
        DEFAULT NOW(),
    updated_at TIMESTAMP NOT NULL
        DEFAULT NOW()
);

The jobs table uses job_id as its primary key and stores the fields needed for polling, updates, and recovery. section 9.2.1

The runtime places the job ID in a context variable before starting the background task. Workflow code can then report progress without passing the ID explicitly. Checkpoint calls use the same context pattern to save intermediate state; the original request and assigned endpoint also help identify and re-dispatch orphaned jobs after a crash. section 9.2.2 section 9.2.1

Asynchronous document ingestion

An ingestion request returns an IngestJob with a job ID immediately. Its status moves from queued to processing, then to completed or failed; progress updates as pipeline stages finish. On success, document_id identifies the newly ingested document, distinct from the job ID used to check the ingestion job. On failure, the error field records what went wrong. section 5.3.9

A workflow calling an asynchronous child can hide polling from the parent: call() reads the job ID from the 202 response, polls until completion, and returns the result. A failed or cancelled job instead raises an error. section 9.4.3

How Designing AI Systems covers it

How deep it goes
Explains job creation, polling, record storage, progress updates, and recovery through interfaces and implementations.
Examples
Uses document ingestion and a long-running research workflow to illustrate job IDs and status tracking.
What you can do after
Apply job IDs through the workflow service to submit asynchronous work, report progress, and poll for results.
How it connects
Connects asynchronous workflows to polling, progress reporting, checkpointing, and crash recovery.

This explainer was generated by Manning's knowledge graph from the text of Designing AI Systems. The section links point to the parts of the book it draws on.