Skip to content

Commit

Permalink
Make the output for the current benchmark that's running more compact (
Browse files Browse the repository at this point in the history
  • Loading branch information
smarr authored May 3, 2024
2 parents a762e07 + 15a1b86 commit 1de0e22
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ jobs:
name: "macOS: Python 3.11"
steps:
- name: Checkout ReBench
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.11"

Expand Down Expand Up @@ -91,7 +91,7 @@ jobs:
apt-get install -y --no-install-recommends time
- name: Checkout ReBench
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install PyTest
run: pip3 install pytest
Expand Down
26 changes: 23 additions & 3 deletions rebench/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,19 @@ def __init__(self, executor, ui, print_execution_plan):
self._runs_completed = 0
self._start_time = time()
self._total_num_runs = 0
self._progress_label = self._get_progress_label("70")

def _get_progress_label(self, num_chars):
return "Running %" + num_chars + "s\t%10.1f%s\tleft: %02d:%02d:%02d"

def _set_min_num_chars_for_run_strings(self, runs):
max_len = 0
for run in runs:
run_str = self._run_string_for_progress(run)
l = len(run_str)
if l > max_len:
max_len = l
self._progress_label = self._get_progress_label(str(max_len))

@staticmethod
def _filter_out_completed_runs(runs, ui):
Expand All @@ -74,6 +87,10 @@ def _estimate_time_left(self):
hour = (etl - sec - minute) / 60 / 60
return floor(hour), floor(minute), floor(sec)

@staticmethod
def _run_string_for_progress(run):
return run.as_simple_string().replace(" None", "")

def _indicate_progress(self, completed_task, run):
if not self.ui.spinner_initialized() or self._print_execution_plan:
return
Expand All @@ -82,12 +99,12 @@ def _indicate_progress(self, completed_task, run):
self._runs_completed += 1

art_mean = run.get_mean_of_totals()
art_unit = run.total_unit

hour, minute, sec = self._estimate_time_left()

run_details = run.as_simple_string().replace(" None", "")
label = "Running Benchmarks: %70s\tmean: %10.1f\ttime left: %02d:%02d:%02d" \
% (run_details, art_mean, hour, minute, sec)
run_details = self._run_string_for_progress(run)
label = self._progress_label % (run_details, art_mean, art_unit, hour, minute, sec)
self.ui.step_spinner(self._runs_completed, label)

def indicate_build(self, run_id):
Expand All @@ -110,6 +127,7 @@ def execute(self):
class BatchScheduler(RunScheduler):

def _process_remaining_runs(self, runs):
self._set_min_num_chars_for_run_strings(runs)
remaining_runs = list(runs)
while len(remaining_runs) > 0:
run_id = remaining_runs.pop(0)
Expand All @@ -130,6 +148,7 @@ def _process_remaining_runs(self, runs):
class RoundRobinScheduler(RunScheduler):

def _process_remaining_runs(self, runs):
self._set_min_num_chars_for_run_strings(runs)
task_list = deque(runs)
while task_list:
try:
Expand All @@ -150,6 +169,7 @@ def _process_remaining_runs(self, runs):
class RandomScheduler(RunScheduler):

def _process_remaining_runs(self, runs):
self._set_min_num_chars_for_run_strings(runs)
task_list = list(runs)
while task_list:
run = random.choice(task_list)
Expand Down

0 comments on commit 1de0e22

Please sign in to comment.