The doing bin
A station works on a copy of the workpiece in doing/, never on the original. If the process dies halfway, by a crash, a reboot or a killed job, the original is still in input/, and the half-finished copy is the only thing left in doing/.
What the design has to survive
A run can stop at any point. After it stops:
- The original must still be there, so the work can run again from the same start.
- Partial work must look partial, so no station mistakes it for finished work.
- Recovery must be visible. Listing the folders should show what happened.
Why not the two simpler layouts
Work directly in input/. A crash leaves the input with some new files in it. Nothing tells you whether those files are complete, so a retry first has to work out what to delete. And the receipt in done/ would no longer show what the station was given.
Write straight into output/. A crash leaves half a workpiece where the next station looks for finished ones. Before every run, something would have to judge each folder in output/: finished, or abandoned? That takes extra state, such as a status file or timestamps, and it breaks easily.
What a crash leaves behind
Only an orphan in doing/. The original is still in input/, because it is moved to done/ or failed/ only at the very end.
Recovery needs no judgement: anything in doing/ when a station starts is left over from a crash, so it is deleted, and the workpiece runs again from input/. In Assembly Line, a factory session clears every doing/ bin when it starts.
The cost
One copy of each workpiece at each station. Copying a folder on the same disk is fast, and in return crash safety comes from the folder layout, not from code each station has to get right.
Related
- Bins: the five bins and how a workpiece moves through them
- Write a station that processes workpieces: the lib-factory helper that does the copy and the moves for you