Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ all releases are available on `PyPI <https://pypi.org/project/pytask>`_ and
- :gh:`118` makes the path to the configuration in the session header os-specific.
- :gh:`119` changes that when marker or keyword expressions are used to select tasks,
also the predecessors of the selected tasks will be executed.
- :gh:`120` implements that a single ``KeyboardInterrupt`` stops the execution and
previously collected reports are shown.


0.0.16 - 2021-06-25
Expand Down
5 changes: 5 additions & 0 deletions src/_pytask/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from _pytask.nodes import FilePathNode
from _pytask.report import ExecutionReport
from _pytask.shared import reduce_node_name
from _pytask.traceback import remove_traceback_from_exc_info
from rich.traceback import Traceback


Expand Down Expand Up @@ -67,6 +68,10 @@ def pytask_execute_task_protocol(session, task):
session.hook.pytask_execute_task_setup(session=session, task=task)
session.hook.pytask_execute_task(session=session, task=task)
session.hook.pytask_execute_task_teardown(session=session, task=task)
except KeyboardInterrupt:
short_exc_info = remove_traceback_from_exc_info(sys.exc_info())
report = ExecutionReport.from_task_and_exception(task, short_exc_info)
session.should_stop = True
except Exception:
report = ExecutionReport.from_task_and_exception(task, sys.exc_info())
else:
Expand Down
1 change: 0 additions & 1 deletion src/_pytask/live.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,5 +167,4 @@ def _generate_status(self):
if self._n_errors > 0:
msg += f" {self._n_errors} errors."
status = Status(msg, spinner="dots")
status._name = "collection_status"
return status
2 changes: 2 additions & 0 deletions src/_pytask/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,6 @@ def _style_infos(infos: List[Tuple[Any]]) -> str:
for value, description, color in infos:
if value:
message.append(f"[{color}]{value} {description}[/]")
if not message:
message = ["nothing to report"]
return ", ".join(message)