Overview

A Sieve job represents a single execution of a Sieve function. When you call a function using either the .run() or .push() methods, Sieve creates a job to handle that execution. Jobs can be monitored and managed through the Sieve dashboard.

Jobs have several important characteristics:

  • Each job has a unique ID that can be used to track its progress and retrieve its outputs
  • Jobs can be in the following states: “queued”, “processing”, “finished”, “error” or “cancelled”.
  • Jobs maintain information about their inputs, outputs, and execution time
  • When a job is created using .push(), it returns a SieveFuture object that can be used to track the job’s progress and retrieve its results

Structure

When you retrieve information about a job, you’ll receive a response with the following structure:

{
    "id": "string",                    // Unique identifier for the job
    "function_id": "string",           // ID of the function being executed
    "organization_id": "string",       // ID of the organization that owns the job
    "function": {...details...},       // Detailed information about the function
    "status": "string",                // Current status: "queued", "started", "finished", or "error"
    "created_at": "string",            // Timestamp when the job was created
    "started_at": "string",            // Timestamp when the job started
    "completed_at": "string",          // Timestamp when the job completed
    "inputs": {                        // Input parameters for the job
        "parameter_name": {
            "type": "string",          // Type of the parameter
            "name": "string",          // Name of the parameter
            "data": any,               // Value of the parameter
            "description": "string",   // Description of the parameter
            "schema": object,          // Schema definition for the parameter
            "run_id": "string"         // Run ID if applicable
        },
        "another_parameter": {
            "type": "string",
            "name": "string",
            "data": any,
            "description": "string",
            "schema": object,
            "run_id": "string"
        },
        ...
    },
    "outputs": [                       // Output results from the job
        {
            "type": "string",          // Type of the output
            "name": "string",          // Name of the output
            "data": object,            // Output data
            "description": "string",   // Description of the output
            "schema": object,          // Schema definition for the output
            "run_id": "string"         // Run ID if applicable
        }
    ],
    "error": "string",                 // Error message if the job failed
    "visibility": "string",            // Visibility setting of the job
    "run_id": "string",                // Unique run identifier
    "children": ["string"],            // Child job IDs if applicable
    "restarts": number                 // Number of times the job has been restarted
}