1
1
"""This module contains code related to outcomes."""
2
2
from enum import auto
3
3
from enum import Enum
4
+ from enum import IntEnum
4
5
from typing import Dict
5
6
from typing import Optional
6
7
from typing import Sequence
@@ -99,6 +100,7 @@ class TaskOutcome(Enum):
99
100
100
101
@property
101
102
def symbol (self ) -> str :
103
+ """The symbol of an outcome."""
102
104
symbols = {
103
105
TaskOutcome .SUCCESS : "." ,
104
106
TaskOutcome .PERSISTENCE : "p" ,
@@ -112,6 +114,7 @@ def symbol(self) -> str:
112
114
113
115
@property
114
116
def description (self ) -> str :
117
+ """A description of an outcome used in the summary panel."""
115
118
descriptions = {
116
119
TaskOutcome .SUCCESS : "Succeeded" ,
117
120
TaskOutcome .PERSISTENCE : "Persisted" ,
@@ -125,6 +128,7 @@ def description(self) -> str:
125
128
126
129
@property
127
130
def style (self ) -> str :
131
+ """Return the style of an outcome."""
128
132
styles = {
129
133
TaskOutcome .SUCCESS : "success" ,
130
134
TaskOutcome .PERSISTENCE : "success" ,
@@ -138,6 +142,7 @@ def style(self) -> str:
138
142
139
143
@property
140
144
def style_textonly (self ) -> str :
145
+ """Return the style of an outcome when only the text is colored."""
141
146
styles_textonly = {
142
147
TaskOutcome .SUCCESS : "success.textonly" ,
143
148
TaskOutcome .PERSISTENCE : "success.textonly" ,
@@ -169,6 +174,24 @@ def count_outcomes(
169
174
}
170
175
171
176
177
+ class ExitCode (IntEnum ):
178
+ """Exit codes for pytask."""
179
+
180
+ OK = 0
181
+ """Tasks were executed successfully."""
182
+
183
+ FAILED = 1
184
+ """Failed while executing tasks."""
185
+
186
+ CONFIGURATION_FAILED = 2
187
+
188
+ COLLECTION_FAILED = 3
189
+ """Failed while collecting tasks."""
190
+
191
+ RESOLVING_DEPENDENCIES_FAILED = 4
192
+ """Failed while resolving dependencies."""
193
+
194
+
172
195
class PytaskOutcome (Exception ):
173
196
"""Base outcome of a task."""
174
197
0 commit comments