The Nexus repository server by Sonatype offers a classical REST API. When an operation is triggered through the REST API, the call returns immediately, indicating through its status code whether or not the operation was started successfully. I am looking for a way to detect whether and when a job finished successfully.
In my concrete case, I am starting a backup task that writes out configuration databases in a serialized format to disk:
curl -X POST "$mynexus/service/rest/v1/tasks/$task-id/run" -H "accept: application/json"
which returns a 204 "task was run" immediately.
However, minutes after that happens, a manual check indicates that the on-disk file created by that task is still growing. Of course, I could try watching the output of lsof
until that task seems finished, but that would be highly impractical, require root access to the server and also break the REST design.
A similar question here has not received an answer since 2016, so I'll ask in a more general way, in the hope that the answer will be more generally applicable:
How can a REST client detect that an operation has completely finished on the server side when talking to a Sonatype Nexus 3.x series server?
If there is no such way, would you consider that an issue with Nexus or would you recommend to create a custom workaround?
question from:
https://stackoverflow.com/questions/65847936/detecting-when-a-task-has-finished-through-rest-apis 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…