A small reader tells us who is using a shared GPU line. It does that by reading the files the line’s service keeps: one small JSON file per image order, with who sent it, when it arrived, how long it took and its status. During a debugging pass the same morning it was written, the reader showed two failed orders, one from each of two different callers. Neither had failed.
A file that is also written at the start
The reader had been built on an assumption: an order file is written once, when the order ends. Under that rule, a file whose status is not a finished one can only mean the order ended badly, so the reader counted it as a failure.
The service does not work that way. It writes the order file when it accepts an order, with a status of accepted and then running, and writes it again when the order finishes. An order that is still in flight therefore has a file on disk the whole time, and to a reader expecting only final states it looks exactly like an order that stopped partway. The two “failures” were orders of that kind.
The fix was to stop forcing every file into done or failed. Orders in the accepted or running state now go into their own in-flight group, and that group counts toward whether the line is busy. Before, the reader’s only sign of work in progress was the single image the service’s health endpoint reported; an accepted order waiting behind it did not make the line busy at all, it made a failure.
Why it mattered here
The same debugging pass added two line-level alarms: one when the same image has been running for 15 minutes or more, and one when three or more failures land within a window. A failure count that includes work still in progress would feed that second alarm with orders that are merely busy. After the change, the tests passed across all 10 modules, and the observer’s one-minute cycle exited cleanly, with a full read taking 0.55 seconds.
What I did not check: the log does not record how those two orders eventually ended, so I cannot say whether they completed. The fix is about how an unfinished file is classified, not about those particular orders.
A file’s status only means “final” if the file is written only at the end. Before counting a state as an outcome, find out every moment the file gets written.