Skip to content

Commit

Permalink
Upgrade to thespian 3.8.0
Browse files Browse the repository at this point in the history
With this commit we upgrade to thespian 3.8.0 and replace a workaround
to use multiple timers per actor with the now available proper solution.

Closes #318
  • Loading branch information
danielmitterdorfer committed Sep 14, 2017
1 parent 77388a7 commit 57dea5a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
11 changes: 5 additions & 6 deletions esrally/driver/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,10 @@ def __init__(self, metrics, next_task_scheduled_in):


class DriverActor(actor.RallyActor):
RESET_RELATIVE_TIME_MARKER = "reset_relative_time"

WAKEUP_INTERVAL_SECONDS = 1

"""
Coordinates all worker drivers. This is actually only a thin actor wrapper layer around ``Driver`` which does the actual work.
"""
Expand All @@ -156,9 +159,7 @@ def receiveMessage(self, msg, sender):
elif isinstance(msg, UpdateSamples):
self.update_samples(msg)
elif isinstance(msg, thespian.actors.WakeupMessage):
# workaround to detect multiple timers firing at different intervals. We should actually determine them via some other means
# e.g. a payload.
if msg.delayPeriod != datetime.timedelta(seconds=DriverActor.WAKEUP_INTERVAL_SECONDS):
if msg.payload == DriverActor.RESET_RELATIVE_TIME_MARKER:
self.coordinator.reset_relative_time()
elif not self.coordinator.finished():
self.coordinator.update_progress_message()
Expand Down Expand Up @@ -221,9 +222,7 @@ def complete_current_task(self, driver):

def on_task_finished(self, metrics, next_task_scheduled_in):
if next_task_scheduled_in > 0:
assert next_task_scheduled_in != DriverActor.WAKEUP_INTERVAL_SECONDS, \
"Due to a (temporary) workaround the task schedule interval must be different than the wakeup interval."
self.wakeupAfter(datetime.timedelta(seconds=next_task_scheduled_in))
self.wakeupAfter(datetime.timedelta(seconds=next_task_scheduled_in), payload=DriverActor.RESET_RELATIVE_TIME_MARKER)
else:
self.coordinator.reset_relative_time()
self.send(self.start_sender, TaskFinished(metrics, next_task_scheduled_in))
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def str_from_file(name):
"jsonschema==2.5.1",
"Jinja2==2.9.5",
# remote messaging
"thespian==3.7.3",
"thespian==3.8.0",
# recommended library for thespian to identify actors more easily with `ps`
# "setproctitle==1.1.10",
# always use the latest version, these are certificate files...
Expand Down

0 comments on commit 57dea5a

Please sign in to comment.