Container exit_code should be updated earlier, before copying staged outputs
Currently crunch-run updates
output at the same time, when setting
state=Complete -- in fact, RailsAPI doesn't allow updating
This means that in the case where outputs are staged in the local filesystem, the
exit_code is not propagated back to the database / other clients / users until after copying staged outputs to keep, which can take a while. During that interval, the exit code is shown in the log, but not in the container record.
If we adjust the RailsAPI constraint, and have crunch-run save the exit_code as soon as it's known, workbench2 and other clients can easily show this to the user earlier.