-
Notifications
You must be signed in to change notification settings - Fork 313
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
Add flag to handle running processes automatically #954
Add flag to handle running processes automatically #954
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. I did a first pass and left some suggestions.
esrally/rally.py
Outdated
|
||
if kill_running_processes: | ||
console.info("Killing running processes ...", flush=True) | ||
for pid in pids: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already had this functionality prior to 8adb0f8. Can you please check how it was done there and restore that functionality? I also don't recall that it was necessary to make the actor system bootstrap code aware of this so I'd try to avoid it (after restoring the functionality removed in 8adb0f8).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure! I restored the previous functionality and avoided changes in the actor system bootstrap code. Thanks for your suggestion. Can you check again if something needs to be changed?
esrally/rally.py
Outdated
|
||
if kill_running_processes: | ||
console.info("Killing running processes ...", flush=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a log message is sufficient?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed. Can you check again?
``kill-running-processes`` | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
Only one Rally benchmark is allowed to run at the same time. If any processes is running, it is going to kill them and allow Rally to continue to run a new benchmark. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could add an explanation why we want that (in order to ensure that benchmark results are not skewed due to unintentionally running multiple benchmarks at the same time).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added more information in the docs about why we want that. Can you check again?
@elasticmachine test this please |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! That looks much better; I left a few more comments.
docs/command_line_reference.rst
Outdated
``kill-running-processes`` | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
Rally attempts to generate benchmark results that are not skewed unintentionally. Consequently, if some benchmark is running, Rally will not allow you to start another one. Instead, you should stop the current benchmark and start another one manually. This flag can be added to handle automatically for you this stop-start processes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: for you this stop-start process
-> this process for you
?
tests/utils/process_test.py
Outdated
self.assertTrue(rally_process_e.killed) | ||
self.assertTrue(rally_process_mac.killed) | ||
self.assertFalse(own_rally_process.killed) | ||
self.assertFalse(night_rally_process.killed) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Missing trailing new line
esrally/rally.py
Outdated
if other_rally_processes: | ||
pids = [p.pid for p in other_rally_processes] | ||
|
||
msg = "There are other Rally processes running on this machine (PIDs: %s) but only one Rally benchmark " \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are using .format
and recently f-strings so can you please rewrite this as:
msg = f"There are other Rally processes running on this machine (PIDs: {pids}) but only one Rally " \
f"benchmark is allowed to run at the same time.\n\nPlease rerun with --kill-running-processes to " \
f"terminate them automatically."
(I also suggested a slightly different wording)
esrally/rally.py
Outdated
|
||
|
||
def with_actor_system(runnable, cfg): | ||
def with_actor_system(runnable, cfg, kill_running_processes): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be a leftover?
esrally/rally.py
Outdated
|
||
with_actor_system(racecontrol.run, cfg) | ||
with_actor_system(racecontrol.run, cfg, kill_running_processes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be a leftover?
esrally/rally.py
Outdated
raise exceptions.RallyError(msg) | ||
logger = logging.getLogger(__name__) | ||
|
||
kill_running_processes = cfg.opts("system", "kill.running.processes", default_value=False, mandatory=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can simplify this to:
kill_running_processes = cfg.opts("system", "kill.running.processes")
The value should be mandatory at this point because we added it previously in bootstrap code?
esrally/rally.py
Outdated
@@ -23,6 +23,7 @@ | |||
import sys | |||
import time | |||
import uuid | |||
import signal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The linter in CI raised an error that this import is unused:
12:20:20 esrally/rally.py:26:0: W0611: Unused import signal (unused-import)
Can you please remove it?
@danielmitterdorfer I made the changes you suggested. Can you check again and run the tests? |
@elasticmachine test this please |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your change @bartier! It looks good to me now and the CI build passes as well. I'll merge it soon and it wil be released with the next Rally release 1.5.0.
@danielmitterdorfer Thanks for your attention. Glad to help! |
This PR implements a explicit flag
--kill-running-processes
to Rally that kills automatically previous running Rally benchmarks.This is useful when you stop your terminal with
CTRL-C
and the Rally processes keeps running and the next time you run Rally you'll receive an error something like that:Instead of receiving the message above, you can add
--kill-running-processes
to automatically terminate these processes for you.Ps: I'm not sure if I handled correctly the method
with_actor_system
. I tried follow the logic in this method and make the necessary changes.Link to with_actor_system changes
If the changes in
with_actor_system
is not applied, I receive the following errors:Refers to #922