Add jobs transition matrix
@@ -37,7 +37,20 @@ class JobLifeCycle(BaseStatuses):
(UNKNOWN, UNKNOWN),
)
+ VALUES = {
+ CREATED, BUILDING, RUNNING, SUCCEEDED, FAILED, STOPPED, UNKNOWN
+ }
+
STARTING_STATUS = {CREATED, BUILDING}
RUNNING_STATUS = {BUILDING, RUNNING}
DONE_STATUS = {FAILED, STOPPED, SUCCEEDED}
FAILED_STATUS = {FAILED, }
+
+ TRANSITION_MATRIX = {
+ CREATED: {None, },
+ BUILDING: {CREATED, },
+ RUNNING: {CREATED, UNKNOWN},
+ SUCCEEDED: {CREATED, RUNNING, UNKNOWN, },
+ FAILED: {CREATED, RUNNING, UNKNOWN, },
+ STOPPED: set(VALUES),
+ }
