Project

General

Profile

Idea #3898

Updated by Tom Clegg over 9 years ago

Before validation: 
 * If state has changed to Running, set started_at to now 
 * If state has changed to Failed or Complete, set finished_at to now 
 * If state has changed to Cancelled, set cancelled_at to now 
 * If state has changed at all, set running and success (see below) 
 * If state has not changed, and any of {running, success, cancelled_at} have changed, update state accordingly 
 * If state is nil, update state according to running, success, cancelled_at 

 Validation: 
 * If state has changed to Running, and is_locked_by_uuid is nil, return false 

 Translating from running/success/cancelled_at to state: 
 |running |success |cancelled_at |state      | 
 |any       |any       |not nil        |Cancelled| 
 |any       |false     |nil            |Failed     | 
 |any       |true      |nil            |Complete | 
 |true      |nil       |nil            |Running    | 
 |false     |nil       |nil            |Queued     | 

 Translating from state to running/success: 
 |state       |running |success | 
 |Queued      |false     |nil       | 
 |Running     |true      |nil       | 
 |Cancelled |false     |false     | 
 |Failed      |false     |false     | 
 |Complete    |false     |true      | 

Back