Submit, poll, read: what a long analysis looks like over HTTP
Failure, and what you actually have to handle
Page 4 of 4
Three failures are worth writing code for, and the rest are the ordinary HTTP ones.
The submit can be refused — a malformed input, or a token that has expired. Both are immediate and both tell you which. The job can fail, in which case its status carries the reason and no output is written. And the poll can be interrupted, which is the benign one: the work is not attached to your connection, so you reconnect and ask again.
What you do not have to handle is a partially written result. An output appears when the worker has finished writing it; there is no window in which you can read half of one.
The figures in this piece — including the ones in the panels — are illustrative. They show what a result of this shape looks like, not a measurement of anything that happened.