flexmeasures.api.v3_0.jobs

Classes

class flexmeasures.api.v3_0.jobs.JobAPI

Endpoint for querying the status of background jobs by UUID.

get_job_status(job_id: str, **kwargs)

— get:

summary: Get the status of a background job description: |

Look up a background job by its UUID and see whether it is queued, running, finished, or failed.

The response includes a status message plus job metadata such as the queue name, function name, timestamps, and the job result when available.

Failed jobs also include traceback information when the worker stored it with the job result.

For a finished scheduling job, result is an object. For a StorageScheduler job it holds soft state-of-charge constraint analysis: unresolved lists constraints the scheduler could not satisfy, and resolved lists constraints that were satisfied with some margin. Each device entry’s soc-minima/soc-maxima value is a list, holding one entry per violated slot (for unresolved) or per met slot with its margin (for resolved), ordered chronologically. Both arrays are empty when the flex model defines no soc-minima/soc-maxima, or when a scheduler other than StorageScheduler was used. This is the only place constraint analysis is available — the sensor schedule endpoint (GET /api/v3_0/sensors/<id>/schedules/<uuid>) returns power values only.

security:
  • ApiKeyAuth: []

parameters:
  • in: path name: uuid required: true description: UUID of the background job. example: b3d26a8a-7a43-4a9f-93e1-fc2a869ea97b schema:

    type: string

responses:
200:

description: Job status retrieved successfully. content:

application/json:
schema:

type: object properties:

status:

type: string enum:

  • QUEUED

  • STARTED

  • FINISHED

  • FAILED

  • DEFERRED

  • SCHEDULED

  • STOPPED

  • CANCELED

description: Current status of the job.

message:

type: string description: Human-readable description of the job status.

result:
description: >

Return value of the job function, or null when not yet available. For a finished scheduling job, this is an object; a StorageScheduler job populates it with unresolved/resolved soft state-of-charge constraint analysis (empty arrays when the flex model defines no soc-minima/soc-maxima, or when a scheduler other than StorageScheduler was used).

nullable: true

func_name:

type: string description: Fully-qualified name of the function executed by this job.

origin:

type: string description: Name of the queue the job was placed on.

enqueued_at:

type: string format: date-time nullable: true description: ISO-8601 timestamp of when the job was enqueued.

started_at:

type: string format: date-time nullable: true description: ISO-8601 timestamp of when the job started executing.

ended_at:

type: string format: date-time nullable: true description: ISO-8601 timestamp of when the job finished executing.

exc_info:

type: string nullable: true description: Traceback information for failed jobs, or null otherwise.

examples:
queued:

summary: Queued job value:

status: QUEUED message: “Scheduling job waiting to be processed.” result: null func_name: “flexmeasures.data.services.scheduling.create_schedule” origin: scheduling enqueued_at: “2026-04-28T10:00:00+00:00” started_at: null ended_at: null exc_info: null

finished:

summary: Finished job value:

status: FINISHED message: “Scheduling job has finished.” result:

unresolved:
  • asset: 42 soc-minima:

    • datetime: “2024-01-01T10:00:00+00:00” violation: “260.0 kWh”

    • datetime: “2024-01-01T10:15:00+00:00” violation: “180.0 kWh”

resolved: []

func_name: “flexmeasures.data.services.scheduling.create_schedule” origin: scheduling enqueued_at: “2026-04-28T10:00:00+00:00” started_at: “2026-04-28T10:00:01+00:00” ended_at: “2026-04-28T10:00:05+00:00” exc_info: null

failed:

summary: Failed job value:

status: FAILED message: “Scheduling job failed with ValueError: …” result: null func_name: “flexmeasures.data.services.scheduling.create_schedule” origin: scheduling enqueued_at: “2026-04-28T10:00:00+00:00” started_at: “2026-04-28T10:00:01+00:00” ended_at: “2026-04-28T10:00:02+00:00” exc_info: “Traceback (most recent call last): …”

404:

description: NOT_FOUND

401:

description: UNAUTHORIZED

403:

description: INVALID_SENDER

503:

description: SERVICE_UNAVAILABLE

tags:
  • Jobs