3898: Clean up job state hooks and validations.
3898: Add error messages to assertions. Use assert_raise.
3898: Populate state column using SQL transaction instead of load/save N times.
3898: Update tests to match the updated job status handling.
Bugfix: do not try to overwrite docker_image_locator if it is already set.

refs #3898
3898: Assume a job Failed if it is locked but state fields indicate Queued.
3898: Assume a job Failed if it has started but state fields indicate Queued.
3898: Merge branch 'master' into 3898-job-state-attr-TC
Merge branch '3898-job-state-attr-TC' closes #3898