job_coordinator: Break down do_stage_done function into two functions.

The maybe_event_stage_done function sends an event if the stage is not the dummy
input stage.  This function does not change the state.
The do_next_stage function starts the next stage and changes the state.
job_coordinator: add a field to stage_info to show when a stage has finished.
pipeline_utils: introduce all_deps_finished function.

This function tests whether all of the dependencies of a stage are finished or
not.  It will be used to find out if we can finish a stage.
Merge pull request #503 from pooya/stage_finish

Stage finish