From d170cda3ae4a7f73e18b9c1b96e0601cf7ebc31c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Sat, 16 Jul 2022 12:52:01 +0200 Subject: [PATCH] OAPI: change task log fetching from providing the log to providing metadata The task log API endpoint was loading the entire log into RAM, then sending it as response. This makes display in a browser also a bit harder. The API endpoint now returns some JSON with info about the task log, including its size and which URL can be used to download it. Manifest task: T99730 --- pkg/api/flamenco-openapi.yaml | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/pkg/api/flamenco-openapi.yaml b/pkg/api/flamenco-openapi.yaml index bb55b8d7..e70c27b6 100644 --- a/pkg/api/flamenco-openapi.yaml +++ b/pkg/api/flamenco-openapi.yaml @@ -777,10 +777,10 @@ paths: $ref: "#/components/schemas/Error" /api/v3/tasks/{task_id}/log: - summary: Fetch the task's entire log. + summary: Retrieve info about the task log. get: - operationId: fetchTaskLog - summary: Fetch the entire task log. + operationId: fetchTaskLogInfo + summary: Get the URL of the task log, and some more info. tags: [jobs] parameters: - name: task_id @@ -789,11 +789,11 @@ paths: schema: { type: string, format: uuid } responses: "200": - description: The task log. + description: The task log info. content: - text/plain: + application/json: schema: - type: string + $ref: "#/components/schemas/TaskLogInfo" "204": description: Returned when the task has no log yet. default: @@ -1542,6 +1542,20 @@ components: updated: { type: string, format: date-time } required: [id, name, status, priority, task_type, updated] + TaskLogInfo: + type: object + description: Info about the log of a single task. + properties: + "task_id": { type: string, format: uuid } + "job_id": { type: string, format: uuid } + "url": + description: The URL at which the task log itself can be downloaded. + type: string + "size": + description: The size of the task log, in bytes. + type: integer + required: [task_id, job_id, url, size] + JobLastRenderedImageInfo: description: > Enough information for a client to piece together different strings to