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
Load test suite #819
Load test suite #819
Conversation
beeec8e
to
0eaf884
Compare
f31ff21
to
bddc73d
Compare
I just rebased on develop to fix the conflicts |
alignak/daemon.py
Outdated
:param timeout: timeout to wait for activity | ||
:type timeout: float | ||
:return:Returns a 2-tuple: | ||
* first value is the time spent for the time change chekc |
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.
typo: check
instead chekc
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.
Ok
alignak/daemon.py
Outdated
after = time.time() | ||
|
||
if after - before > timeout: | ||
return after - before, time_changed |
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 prefer store the after - before
in a variable to not have to calculate the same thing many times
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 compiler does it for you 😉
alignak/daemon.py
Outdated
if after - before > timeout: | ||
return after - before, time_changed | ||
# Time to sleep | ||
time.sleep(timeout) |
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.
It's not better to do a sleep of timeout - (after - before)
?
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.
It is a very slight difference, but yes...
alignak/daemons/brokerdaemon.py
Outdated
con = link['con'] = HTTPClient(uri=link['uri'], | ||
strong_ssl=link['hard_ssl_name_check'], | ||
timeout=timeout, data_timeout=data_timeout) | ||
except HTTPClientConnectionException as exp: # pragma: no cover, simple protection |
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.
If you have exceptions in create connection, so we need define link['con'] = None
in all exceptions here
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.
👍
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.
You need add it to all except HTTP....
in all modifications, because we have same thing in many files in your PR
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.
Hmmm... not sure about this. I am looking... breaking the connection when a bad connetion or time out happens is not necessarily a good idea!
alignak/daemons/receiverdaemon.py
Outdated
|
||
is_active = sched['active'] | ||
if not is_active: | ||
logger.warning("The scheduler '%s' is not active, it is not possible to get broks " |
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 message must be it's not possible to push external commands
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.
Yes
alignak/satellite.py
Outdated
@@ -149,6 +151,120 @@ def get_external_commands(self): | |||
self.external_commands = [] | |||
return res | |||
|
|||
@staticmethod | |||
def is_connection_try_too_close(link, delay=5): |
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 function name not very explicite :(
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.
It is not me that defined this ... I kept using a former existing function :/
alignak/satellite.py
Outdated
|
||
def do_pynag_con_init(self, s_id, s_type='scheduler'): | ||
"""Initialize a connection with scheduler having 'uuid' | ||
Return the new connection to the scheduler if it succeeded, |
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 return is always true
, so make description like set the connection if it succeeded, otherwise set it to None
.
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.
Ok
alignak/satellite.py
Outdated
|
||
:param s_id: scheduler s_id to connect to | ||
:type s_id: int | ||
:return: scheduler connection object or None |
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 return is always 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.
Ok
alignak/satellite.py
Outdated
self.pynag_con_init(sched_id) | ||
sched['con'] = con | ||
|
||
if con: |
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.
You can simplify by use else:
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.
Hmm... you found out a bug 😉
It should be: con = sched['con']
... I did not catched this one!
|
||
:param check: check to add | ||
:type check: alignak.check.Check | ||
:return: None | ||
""" | ||
if check is None: | ||
return | ||
if check.uuid in self.checks: | ||
logger.debug("Already existing check: %s", check) |
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.
If we have it, it's not normal, so prefer use error or warning instead debug.
Same for actions, event_handler...
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.
No, it is not a bug... if you set this at WARNING level, you will be spammed on each scheduler start/restart/new configuration ! This is why I left the DEBUG log level...
I am preparing a small refactoring of the Satellite/BaseSatellite classes ... |
@ddurieux: I will merge this PR by myslef after having launched the tests on a more powerful server and after some more checks in the volume of logs produced by each daemon |
As discussed with @ddurieux I merge this PR. Many uninterrupted days of tests with this source code on several servers make it considered as stable enough |
Add a test suite for load tests
Cleanings in the inter-daemon communication
Cleanings in the scheduler loop
Some small fixes
Initially this PR was intended to create a load test suite that runs many checks for a lot of hosts but this raised some problems in the inter-daemon communication that were needed to get fixed!