10
10
from _pytask .report import ExecutionReport
11
11
from _pytask .traceback import remove_internal_traceback_frames_from_exc_info
12
12
from pytask_parallel .backends import PARALLEL_BACKENDS
13
+ from rich .console import ConsoleOptions
13
14
from rich .traceback import Traceback
14
15
15
16
@@ -151,10 +152,11 @@ def pytask_execute_task(session, task): # noqa: N805
151
152
_unserialize_and_execute_task ,
152
153
bytes_ = bytes_ ,
153
154
show_locals = session .config ["show_locals" ],
155
+ console_options = console .options ,
154
156
)
155
157
156
158
157
- def _unserialize_and_execute_task (bytes_ , show_locals ):
159
+ def _unserialize_and_execute_task (bytes_ , show_locals , console_options ):
158
160
"""Unserialize and execute task.
159
161
160
162
This function receives bytes and unpickles them to a task which is them execute
@@ -169,14 +171,16 @@ def _unserialize_and_execute_task(bytes_, show_locals):
169
171
task .execute ()
170
172
except Exception :
171
173
exc_info = sys .exc_info ()
172
- processed_exc_info = _process_exception (exc_info , show_locals )
174
+ processed_exc_info = _process_exception (exc_info , show_locals , console_options )
173
175
return processed_exc_info
174
176
175
177
176
- def _process_exception (exc_info : Tuple [Any ], show_locals : bool ) -> Tuple [Any ]:
178
+ def _process_exception (
179
+ exc_info : Tuple [Any ], show_locals : bool , console_options : ConsoleOptions
180
+ ) -> Tuple [Any ]:
177
181
exc_info = remove_internal_traceback_frames_from_exc_info (exc_info )
178
182
traceback = Traceback .from_exception (* exc_info , show_locals = show_locals )
179
- segments = console .render (traceback )
183
+ segments = console .render (traceback , options = console_options )
180
184
text = "" .join (segment .text for segment in segments )
181
185
return * exc_info [:2 ], text
182
186
0 commit comments