Skip to content

Add success and failure state classes for Task Instances #52722

Description

@seanghaeli

In places like this:

self.success_states = set(success_states) if success_states else {TaskInstanceState.SUCCESS.value}
self.failure_states = set(failure_states) if failure_states else {TaskInstanceState.FAILED.value}

in which we enumerate through success and failure states of task instances, this is currently being hardcoded. As @eladkal points out, if new states are added in the future, there is no protection.

is this logic right? If we fall back to the defaults it will consider skipped and removed as in progress state.
Also, there is no protection here against possible future addition of new state to task instance. For example we are discussing #12199

I suggest to add defensive test around adding more states so we'll know to modify code here or maybe we can consider adding more classes to categorized states similar to

class TerminalTIState(str, Enum):
SUCCESS = "success"
FAILED = "failed"
SKIPPED = "skipped"
REMOVED = "removed"

Originally posted by @eladkal in #51719 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions