Currently Task Status is encoded as a string, and there is sort of a hierarchy defined in the CbrainTask class, as shown below. Testing a Task's status is messy, and there is no easy way to tell if a Task is Started/Stopped, if it can be Restarted, etc. Task Status should be refactored into a class that encodes the strings below into a better hierarchy.
# List of status for tasks that have completed successfully.
COMPLETED_STATUS = [ "Completed" ]
# List of status for tasks that are proceeding on the normal processing path.
QUEUED_STATUS = [ "New", "Standby", "Configured", "Queued", "On Hold", "Suspended", "Data Ready" ] # waiting for something
# List of status for tasks that are actively processing (in Ruby stages or on CPU on the cluster)
PROCESSING_STATUS = [ "Setting Up", "On CPU", "Post Processing" ] # actually running code
# List of status for tasks that are considered active on the normal processing path.
RUNNING_STATUS = [ "New", "Setting Up", "Queued", "On CPU", "Data Ready", "Post Processing"] # main path
# List of status for tasks that have failed.
FAILED_STATUS = [ "Failed To Setup", "Failed To PostProcess", "Failed On Cluster",
"Failed Setup Prerequisites", "Failed PostProcess Prerequisites",
"Terminated" ]
# List of status for tasks that are on the 'recover' paths.
RECOVER_STATUS = [ "Recover Setup", "Recover Cluster", "Recover PostProcess",
"Recovering Setup", "Recovering Cluster", "Recovering PostProcess" ]
# List of status for tasks that are on the 'restart' paths.
RESTART_STATUS = [ "Restart Setup", "Restart Cluster", "Restart PostProcess",
"Restarting Setup", "Restarting Cluster", "Restarting PostProcess" ]
# List of other administrative status.
OTHER_STATUS = [ "Preset", "Duplicated" ]
# List of status for tasks that are executing Ruby code.
RUBY_STATUS = [ "Setting Up", "Post Processing",
"Recovering Setup", "Recovering Cluster", "Recovering PostProcess",
"Restarting Setup", "Restarting Cluster", "Restarting PostProcess" ]
# List of status for tasks that active in any way.
ACTIVE_STATUS = QUEUED_STATUS | PROCESSING_STATUS | RECOVER_STATUS | RESTART_STATUS
# List of all status keywords.
ALL_STATUS = ACTIVE_STATUS | COMPLETED_STATUS | RUNNING_STATUS | FAILED_STATUS | OTHER_STATUS
Currently Task Status is encoded as a string, and there is sort of a hierarchy defined in the CbrainTask class, as shown below. Testing a Task's status is messy, and there is no easy way to tell if a Task is Started/Stopped, if it can be Restarted, etc. Task Status should be refactored into a class that encodes the strings below into a better hierarchy.