Skip to main content
. 2026 Jul 15;16(14):2214. doi: 10.3390/diagnostics16142214
Algorithm 1. Pseudocode of the simplified orchestration logic.
Input: POST request containing an uploaded imaging file and JSON metadata
Output: job_id or pipeline_id, job status, and output artefacts
1. Receive request through POST/inference or POST/pipeline
2. Validate metadata and save the uploaded input file
3. If the request is a single-model inference: {
4.    Read Model and Priority from metadata
5.    Select the RQ queue using (Model, Priority)
6.    Enqueue the corresponding model function as an asynchronous job
7.    Return job_id, queue name, priority, and initial status
}
8. If the request is a multi-step pipeline: {
9.    Create pipeline_id
10.   For each pipeline step:
11.     Read Model and Priority
12.     Select the RQ queue using (Model, Priority)
13.     Enqueue the step as an asynchronous job
14.     If this is not the first step, set depends on to the previous job
15.   Store pipeline_id and all job_ids in Redis
16.   Return pipeline_id and step job_ids
}
17. RQ workers execute queued jobs asynchronously
18. Status endpoints read job or pipeline state from Redis/RQ
19. Result endpoints return the completed job result or the final pipeline output
20. If a pipeline step fails, queued dependent steps are cancelled