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": {