Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mikolaï Krol
erp5
Commits
a671c94e
Commit
a671c94e
authored
Jan 14, 2020
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
scalability: wait for site-availability before getting metrics.
parent
83f1427c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
3 deletions
+24
-3
erp5/util/benchmark/thread.py
erp5/util/benchmark/thread.py
+16
-1
erp5/util/scalability/runScalabilityTestSuite.py
erp5/util/scalability/runScalabilityTestSuite.py
+6
-1
erp5/util/testnode/ScalabilityTestRunner.py
erp5/util/testnode/ScalabilityTestRunner.py
+2
-1
No files found.
erp5/util/benchmark/thread.py
View file @
a671c94e
...
...
@@ -29,6 +29,11 @@ import threading
import
time
import
requests
# max time to wait for site availability before getting metrics
CHECK_SITE_AVAILABILITY_TIMEOUT
=
60
*
30
# interval to check site availability
CHECK_SITE_AVAILABILITY_INTERVAL
=
60
class
TestThread
(
threading
.
Thread
):
def
__init__
(
self
,
process_manager
,
command
,
log
,
env
=
{}):
...
...
@@ -43,9 +48,10 @@ class TestThread(threading.Thread):
class
TestMetricThread
(
threading
.
Thread
):
def
__init__
(
self
,
metric_url
,
log
,
stop_event
,
interval
=
60
):
def
__init__
(
self
,
metric_url
,
site_availability_url
,
log
,
stop_event
,
interval
=
60
):
threading
.
Thread
.
__init__
(
self
)
self
.
metric_url
=
metric_url
self
.
site_availability_url
=
site_availability_url
self
.
log
=
log
self
.
interval
=
interval
self
.
stop_event
=
stop_event
...
...
@@ -55,6 +61,15 @@ class TestMetricThread(threading.Thread):
def
run
(
self
):
while
(
not
self
.
stop_event
.
is_set
()):
self
.
stop_event
.
wait
(
-
time
.
time
()
%
self
.
interval
)
start_time
=
time
.
time
()
while
CHECK_SITE_AVAILABILITY_TIMEOUT
>
time
.
time
()
-
start_time
:
try
:
response
=
requests
.
get
(
self
.
site_availability_url
,
timeout
=
60
)
if
response
.
status_code
==
200
and
response
.
content
.
strip
()
==
'0'
:
break
except
Exception
as
e
:
self
.
log
(
'Error checking site availability: %s'
%
e
)
time
.
sleep
(
CHECK_SITE_AVAILABILITY_INTERVAL
)
try
:
response
=
requests
.
get
(
self
.
metric_url
,
timeout
=
60
)
if
response
.
status_code
==
200
:
...
...
erp5/util/scalability/runScalabilityTestSuite.py
View file @
a671c94e
...
...
@@ -139,6 +139,10 @@ class ScalabilityLauncher(object):
metavar
=
'METRIC_URL'
,
help
=
'Url to connect to instance metric generator'
)
parser
.
add_argument
(
'--site-availability-url'
,
metavar
=
'SITE_AVAILABILITY_URL'
,
help
=
'Url to check instance availability'
)
@
staticmethod
def
_checkParsedArguments
(
namespace
):
return
namespace
...
...
@@ -230,10 +234,11 @@ class ScalabilityLauncher(object):
tester_path
=
self
.
__argumentNamespace
.
runner_path
instance_url
=
self
.
__argumentNamespace
.
instance_url
metric_url
=
self
.
__argumentNamespace
.
metric_url
site_availability_url
=
self
.
__argumentNamespace
.
site_availability_url
# To take metrics
metric_thread_stop_event
=
threading
.
Event
()
metric_thread
=
TestMetricThread
(
metric_url
,
self
.
log
,
metric_thread_stop_event
,
interval
=
TEST_METRIC_TIME_INTERVAL
)
metric_thread
=
TestMetricThread
(
metric_url
,
s
ite_availability_url
,
s
elf
.
log
,
metric_thread_stop_event
,
interval
=
TEST_METRIC_TIME_INTERVAL
)
metric_thread
.
start
()
bootstrap_password
=
self
.
__argumentNamespace
.
bootstrap_password
...
...
erp5/util/testnode/ScalabilityTestRunner.py
View file @
a671c94e
...
...
@@ -650,7 +650,8 @@ Require valid-user
"--runner-path"
,
runner
,
"--repo-location"
,
repo_location
,
"--log-path"
,
log_path
,
"--metric-url"
,
metric_url
"--metric-url"
,
metric_url
,
"--site-availability-url"
,
site_availability_url
,
]
logger
.
info
(
"Running test case..."
)
test_thread
=
TestThread
(
self
.
testnode
.
process_manager
,
command
,
logger
.
info
,
env
=
self
.
exec_env
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment