Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bugfix] Reset poll rate every time a test finishes the compilation or run phase #2534

Merged
merged 4 commits into from
Jun 10, 2022
Merged
Changes from 1 commit
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
26 changes: 11 additions & 15 deletions reframe/frontend/executors/policies.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,17 @@ def __init__(self):
self._sleep_duration = None
self._t_init = None

def running_tasks(self, num_tasks):
if self._sleep_duration is None:
def set_sleep_duration(self, reset=False):
if self._sleep_duration is None or reset:
self._sleep_duration = self.SLEEP_MIN
else:
self._sleep_duration = min(
self._sleep_duration*self.SLEEP_INC_RATE, self.SLEEP_MAX
)

if self._num_polls == 0:
self._t_init = time.time()
else:
if self._num_tasks != num_tasks:
self._sleep_duration = self.SLEEP_MIN
else:
self._sleep_duration = min(
self._sleep_duration*self.SLEEP_INC_RATE, self.SLEEP_MAX
)

self._num_tasks = num_tasks
return self

def snooze(self):
Expand Down Expand Up @@ -120,7 +116,6 @@ def runcase(self, case):
task.skip()
raise TaskExit from e

partname = task.testcase.partition.fullname
task.setup(task.testcase.partition,
task.testcase.environ,
sched_flex_alloc_nodes=self.sched_flex_alloc_nodes,
Expand All @@ -136,12 +131,13 @@ def runcase(self, case):
else:
sched = partition.scheduler

self._pollctl.set_sleep_duration(reset=True)
while True:
sched.poll(task.check.job)
if task.run_complete():
break

self._pollctl.running_tasks(1).snooze()
self._pollctl.set_sleep_duration()

task.run_wait()
if not self.skip_sanity_check:
Expand Down Expand Up @@ -349,7 +345,7 @@ def exit(self):
)

if num_running:
self._pollctl.running_tasks(num_running).snooze()
self._pollctl.set_sleep_duration().snooze()
except ABORT_REASONS as e:
self._failall(e)
raise
Expand Down Expand Up @@ -565,10 +561,10 @@ def on_task_compile(self, task):
pass

def on_task_exit(self, task):
pass
self._pollctl.set_sleep_duration(reset=True)

def on_task_compile_exit(self, task):
pass
self._pollctl.set_sleep_duration(reset=True)

def on_task_skip(self, task):
msg = str(task.exc_info[1])
Expand Down