Skip to content
Closed
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
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ dev = [
"mypy>=1.7.0,<2",
"pyinstaller==6.11.0",
"ruff>=0.15.20",
"debugpy>=1.8.21",
]

[build-system]
Expand Down
3 changes: 3 additions & 0 deletions src/pyallel/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ def lines() -> int:

ICONS = ("/", "-", "\\", "|")

# The maximum time to wait between renders in seconds
MAX_WAIT_BETWEEN_RENDERS = 0.1

# Unicode character bytes to render different symbols in the terminal
TICK = "\u2714"
X = "\u2718"
22 changes: 11 additions & 11 deletions src/pyallel/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import importlib.metadata
import logging
import sys
import time
import traceback

from pyallel import constants
Expand Down Expand Up @@ -64,12 +63,12 @@ def entry_point(*args: str) -> int:

if exit_code == 1:
logger.error("failed run with arguments:\n%s", parsed_args)
process_group = process_group_manager.get_cur_process_group_output()
process_group = process_group_manager.cur_process_group
print(f"\n{colours.red_bold}ERROR: the following commands failed{colours.reset_colour}")
for process_output in process_group.processes:
process_poll = process_output.process.poll()
for process in process_group.processes:
process_poll = process.poll()
if process_poll and process_poll > 0:
print(f" {colours.red_bold}{process_output.process.command}{colours.reset_colour}")
print(f" {colours.red_bold}{process.command}{colours.reset_colour}")
else:
logger.debug("finished run with arguments:\n%s", parsed_args)

Expand All @@ -79,15 +78,16 @@ def entry_point(*args: str) -> int:
def run(process_group_manager: ProcessGroupManager, printer: Printer) -> int:
process_group_manager.run()
while True:
process_group_manager.stream()
printer.print(process_group_manager)
output = process_group_manager.stream()
printer.print(output)

poll = process_group_manager.poll()
if poll is not None:
# If we still have new output to print after the process group manager has completed,
# If we still have new output to print after the process group has completed,
# make sure to print it here before continuing
if process_group_manager.stream().has_output():
printer.print(process_group_manager)
process_group_manager.wait_for_update(constants.MAX_WAIT_BETWEEN_RENDERS)
output = process_group_manager.stream()
printer.print(output, done=True)

if poll > 0:
return poll
Expand All @@ -96,7 +96,7 @@ def run(process_group_manager: ProcessGroupManager, printer: Printer) -> int:
if not process_group_manager.next():
return 0

time.sleep(0.1)
process_group_manager.wait_for_update(constants.MAX_WAIT_BETWEEN_RENDERS)


if __name__ == "__main__":
Expand Down
Loading
Loading