initial jobs dashboard

This commit is contained in:
allanice001
2025-09-23 05:33:20 +01:00
parent c50fc1540a
commit 4ee03d5409
27 changed files with 2218 additions and 205 deletions

View File

@@ -2223,6 +2223,360 @@ const docTemplate = `{
}
}
},
"/api/v1/jobs/active": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Currently running jobs (limit default 100)",
"produces": [
"application/json"
],
"tags": [
"jobs"
],
"summary": "Active jobs",
"parameters": [
{
"type": "integer",
"default": 100,
"description": "Max rows",
"name": "limit",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/jobs.JobListItem"
}
}
},
"401": {
"description": "unauthorized",
"schema": {
"type": "string"
}
},
"500": {
"description": "internal error",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/jobs/enqueue": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Schedules a job on a queue with optional args/schedule",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"jobs"
],
"summary": "Manually enqueue a job",
"parameters": [
{
"description": "Enqueue request",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/jobs.EnqueueReq"
}
}
],
"responses": {
"202": {
"description": "Accepted",
"schema": {
"$ref": "#/definitions/jobs.EnqueueResp"
}
},
"400": {
"description": "bad request",
"schema": {
"type": "string"
}
},
"401": {
"description": "unauthorized",
"schema": {
"type": "string"
}
},
"500": {
"description": "internal error",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/jobs/failures": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Failed jobs ordered by most recent (limit default 100)",
"produces": [
"application/json"
],
"tags": [
"jobs"
],
"summary": "Recent failures",
"parameters": [
{
"type": "integer",
"default": 100,
"description": "Max rows",
"name": "limit",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/jobs.JobListItem"
}
}
},
"401": {
"description": "unauthorized",
"schema": {
"type": "string"
}
},
"500": {
"description": "internal error",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/jobs/kpi": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Aggregated counters across all queues",
"produces": [
"application/json"
],
"tags": [
"jobs"
],
"summary": "Jobs KPI",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/jobs.KPI"
}
},
"401": {
"description": "unauthorized",
"schema": {
"type": "string"
}
},
"500": {
"description": "internal error",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/jobs/queues": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Counts and avg duration per queue (last 24h)",
"produces": [
"application/json"
],
"tags": [
"jobs"
],
"summary": "Per-queue rollups",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/jobs.QueueRollup"
}
}
},
"401": {
"description": "unauthorized",
"schema": {
"type": "string"
}
},
"500": {
"description": "internal error",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/jobs/{id}/cancel": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Cancels running or scheduled jobs",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"jobs"
],
"summary": "Cancel a job",
"parameters": [
{
"type": "string",
"description": "Job ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "no content",
"schema": {
"type": "string"
}
},
"400": {
"description": "bad request",
"schema": {
"type": "string"
}
},
"401": {
"description": "unauthorized",
"schema": {
"type": "string"
}
},
"404": {
"description": "not found",
"schema": {
"type": "string"
}
},
"500": {
"description": "internal error",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/jobs/{id}/retry": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Calls Archer ScheduleNow on the job id",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"jobs"
],
"summary": "Retry a job immediately",
"parameters": [
{
"type": "string",
"description": "Job ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "no content",
"schema": {
"type": "string"
}
},
"400": {
"description": "bad request",
"schema": {
"type": "string"
}
},
"401": {
"description": "unauthorized",
"schema": {
"type": "string"
}
},
"404": {
"description": "not found",
"schema": {
"type": "string"
}
},
"500": {
"description": "internal error",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/labels": {
"get": {
"security": [
@@ -6335,6 +6689,110 @@ const docTemplate = `{
}
}
},
"jobs.EnqueueReq": {
"type": "object"
},
"jobs.EnqueueResp": {
"type": "object",
"properties": {
"id": {
"type": "string"
}
}
},
"jobs.JobListItem": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"last_error": {
"type": "string"
},
"max_retry": {
"type": "integer"
},
"queue_name": {
"type": "string"
},
"retry_count": {
"type": "integer"
},
"scheduled_at": {
"type": "string"
},
"started_at": {
"type": "string"
},
"status": {
"type": "string"
},
"updated_at": {
"type": "string"
}
}
},
"jobs.KPI": {
"type": "object",
"properties": {
"dueNow": {
"type": "integer",
"format": "int64"
},
"failed24h": {
"type": "integer",
"format": "int64"
},
"retryable": {
"type": "integer",
"format": "int64"
},
"runningNow": {
"type": "integer",
"format": "int64"
},
"scheduledFuture": {
"type": "integer",
"format": "int64"
},
"succeeded24h": {
"type": "integer",
"format": "int64"
}
}
},
"jobs.QueueRollup": {
"type": "object",
"properties": {
"avgDurationSecs": {
"type": "number",
"format": "float64"
},
"failed24h": {
"type": "integer",
"format": "int64"
},
"queueName": {
"type": "string"
},
"queuedDue": {
"type": "integer",
"format": "int64"
},
"queuedFuture": {
"type": "integer",
"format": "int64"
},
"running": {
"type": "integer",
"format": "int64"
},
"success24h": {
"type": "integer",
"format": "int64"
}
}
},
"labels.addLabelToPoolRequest": {
"type": "object",
"properties": {

View File

@@ -2219,6 +2219,360 @@
}
}
},
"/api/v1/jobs/active": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Currently running jobs (limit default 100)",
"produces": [
"application/json"
],
"tags": [
"jobs"
],
"summary": "Active jobs",
"parameters": [
{
"type": "integer",
"default": 100,
"description": "Max rows",
"name": "limit",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/jobs.JobListItem"
}
}
},
"401": {
"description": "unauthorized",
"schema": {
"type": "string"
}
},
"500": {
"description": "internal error",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/jobs/enqueue": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Schedules a job on a queue with optional args/schedule",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"jobs"
],
"summary": "Manually enqueue a job",
"parameters": [
{
"description": "Enqueue request",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/jobs.EnqueueReq"
}
}
],
"responses": {
"202": {
"description": "Accepted",
"schema": {
"$ref": "#/definitions/jobs.EnqueueResp"
}
},
"400": {
"description": "bad request",
"schema": {
"type": "string"
}
},
"401": {
"description": "unauthorized",
"schema": {
"type": "string"
}
},
"500": {
"description": "internal error",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/jobs/failures": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Failed jobs ordered by most recent (limit default 100)",
"produces": [
"application/json"
],
"tags": [
"jobs"
],
"summary": "Recent failures",
"parameters": [
{
"type": "integer",
"default": 100,
"description": "Max rows",
"name": "limit",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/jobs.JobListItem"
}
}
},
"401": {
"description": "unauthorized",
"schema": {
"type": "string"
}
},
"500": {
"description": "internal error",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/jobs/kpi": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Aggregated counters across all queues",
"produces": [
"application/json"
],
"tags": [
"jobs"
],
"summary": "Jobs KPI",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/jobs.KPI"
}
},
"401": {
"description": "unauthorized",
"schema": {
"type": "string"
}
},
"500": {
"description": "internal error",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/jobs/queues": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Counts and avg duration per queue (last 24h)",
"produces": [
"application/json"
],
"tags": [
"jobs"
],
"summary": "Per-queue rollups",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/jobs.QueueRollup"
}
}
},
"401": {
"description": "unauthorized",
"schema": {
"type": "string"
}
},
"500": {
"description": "internal error",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/jobs/{id}/cancel": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Cancels running or scheduled jobs",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"jobs"
],
"summary": "Cancel a job",
"parameters": [
{
"type": "string",
"description": "Job ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "no content",
"schema": {
"type": "string"
}
},
"400": {
"description": "bad request",
"schema": {
"type": "string"
}
},
"401": {
"description": "unauthorized",
"schema": {
"type": "string"
}
},
"404": {
"description": "not found",
"schema": {
"type": "string"
}
},
"500": {
"description": "internal error",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/jobs/{id}/retry": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Calls Archer ScheduleNow on the job id",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"jobs"
],
"summary": "Retry a job immediately",
"parameters": [
{
"type": "string",
"description": "Job ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "no content",
"schema": {
"type": "string"
}
},
"400": {
"description": "bad request",
"schema": {
"type": "string"
}
},
"401": {
"description": "unauthorized",
"schema": {
"type": "string"
}
},
"404": {
"description": "not found",
"schema": {
"type": "string"
}
},
"500": {
"description": "internal error",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/labels": {
"get": {
"security": [
@@ -6331,6 +6685,110 @@
}
}
},
"jobs.EnqueueReq": {
"type": "object"
},
"jobs.EnqueueResp": {
"type": "object",
"properties": {
"id": {
"type": "string"
}
}
},
"jobs.JobListItem": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"last_error": {
"type": "string"
},
"max_retry": {
"type": "integer"
},
"queue_name": {
"type": "string"
},
"retry_count": {
"type": "integer"
},
"scheduled_at": {
"type": "string"
},
"started_at": {
"type": "string"
},
"status": {
"type": "string"
},
"updated_at": {
"type": "string"
}
}
},
"jobs.KPI": {
"type": "object",
"properties": {
"dueNow": {
"type": "integer",
"format": "int64"
},
"failed24h": {
"type": "integer",
"format": "int64"
},
"retryable": {
"type": "integer",
"format": "int64"
},
"runningNow": {
"type": "integer",
"format": "int64"
},
"scheduledFuture": {
"type": "integer",
"format": "int64"
},
"succeeded24h": {
"type": "integer",
"format": "int64"
}
}
},
"jobs.QueueRollup": {
"type": "object",
"properties": {
"avgDurationSecs": {
"type": "number",
"format": "float64"
},
"failed24h": {
"type": "integer",
"format": "int64"
},
"queueName": {
"type": "string"
},
"queuedDue": {
"type": "integer",
"format": "int64"
},
"queuedFuture": {
"type": "integer",
"format": "int64"
},
"running": {
"type": "integer",
"format": "int64"
},
"success24h": {
"type": "integer",
"format": "int64"
}
}
},
"labels.addLabelToPoolRequest": {
"type": "object",
"properties": {

View File

@@ -337,6 +337,78 @@ definitions:
status:
type: string
type: object
jobs.EnqueueReq:
type: object
jobs.EnqueueResp:
properties:
id:
type: string
type: object
jobs.JobListItem:
properties:
id:
type: string
last_error:
type: string
max_retry:
type: integer
queue_name:
type: string
retry_count:
type: integer
scheduled_at:
type: string
started_at:
type: string
status:
type: string
updated_at:
type: string
type: object
jobs.KPI:
properties:
dueNow:
format: int64
type: integer
failed24h:
format: int64
type: integer
retryable:
format: int64
type: integer
runningNow:
format: int64
type: integer
scheduledFuture:
format: int64
type: integer
succeeded24h:
format: int64
type: integer
type: object
jobs.QueueRollup:
properties:
avgDurationSecs:
format: float64
type: number
failed24h:
format: int64
type: integer
queueName:
type: string
queuedDue:
format: int64
type: integer
queuedFuture:
format: int64
type: integer
running:
format: int64
type: integer
success24h:
format: int64
type: integer
type: object
labels.addLabelToPoolRequest:
properties:
node_pool_ids:
@@ -2191,6 +2263,230 @@ paths:
summary: Detach one node pool from a cluster (org scoped)
tags:
- clusters
/api/v1/jobs/{id}/cancel:
post:
consumes:
- application/json
description: Cancels running or scheduled jobs
parameters:
- description: Job ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"204":
description: no content
schema:
type: string
"400":
description: bad request
schema:
type: string
"401":
description: unauthorized
schema:
type: string
"404":
description: not found
schema:
type: string
"500":
description: internal error
schema:
type: string
security:
- BearerAuth: []
summary: Cancel a job
tags:
- jobs
/api/v1/jobs/{id}/retry:
post:
consumes:
- application/json
description: Calls Archer ScheduleNow on the job id
parameters:
- description: Job ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"204":
description: no content
schema:
type: string
"400":
description: bad request
schema:
type: string
"401":
description: unauthorized
schema:
type: string
"404":
description: not found
schema:
type: string
"500":
description: internal error
schema:
type: string
security:
- BearerAuth: []
summary: Retry a job immediately
tags:
- jobs
/api/v1/jobs/active:
get:
description: Currently running jobs (limit default 100)
parameters:
- default: 100
description: Max rows
in: query
name: limit
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/jobs.JobListItem'
type: array
"401":
description: unauthorized
schema:
type: string
"500":
description: internal error
schema:
type: string
security:
- BearerAuth: []
summary: Active jobs
tags:
- jobs
/api/v1/jobs/enqueue:
post:
consumes:
- application/json
description: Schedules a job on a queue with optional args/schedule
parameters:
- description: Enqueue request
in: body
name: payload
required: true
schema:
$ref: '#/definitions/jobs.EnqueueReq'
produces:
- application/json
responses:
"202":
description: Accepted
schema:
$ref: '#/definitions/jobs.EnqueueResp'
"400":
description: bad request
schema:
type: string
"401":
description: unauthorized
schema:
type: string
"500":
description: internal error
schema:
type: string
security:
- BearerAuth: []
summary: Manually enqueue a job
tags:
- jobs
/api/v1/jobs/failures:
get:
description: Failed jobs ordered by most recent (limit default 100)
parameters:
- default: 100
description: Max rows
in: query
name: limit
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/jobs.JobListItem'
type: array
"401":
description: unauthorized
schema:
type: string
"500":
description: internal error
schema:
type: string
security:
- BearerAuth: []
summary: Recent failures
tags:
- jobs
/api/v1/jobs/kpi:
get:
description: Aggregated counters across all queues
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/jobs.KPI'
"401":
description: unauthorized
schema:
type: string
"500":
description: internal error
schema:
type: string
security:
- BearerAuth: []
summary: Jobs KPI
tags:
- jobs
/api/v1/jobs/queues:
get:
description: Counts and avg duration per queue (last 24h)
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/jobs.QueueRollup'
type: array
"401":
description: unauthorized
schema:
type: string
"500":
description: internal error
schema:
type: string
security:
- BearerAuth: []
summary: Per-queue rollups
tags:
- jobs
/api/v1/labels:
get:
consumes: