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
Alexander Emmerich
erp5
Commits
cc7c8b13
Commit
cc7c8b13
authored
Sep 05, 2013
by
Benjamin Blanc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
runScalabilityTestSuite: Fix user index and use new method name
parent
9839c04d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
116 additions
and
129 deletions
+116
-129
erp5/util/scalability/runScalabilityTestSuite.py
erp5/util/scalability/runScalabilityTestSuite.py
+111
-107
erp5/util/taskdistribution/__init__.py
erp5/util/taskdistribution/__init__.py
+5
-22
No files found.
erp5/util/scalability/runScalabilityTestSuite.py
View file @
cc7c8b13
...
@@ -288,117 +288,121 @@ class ScalabilityLauncher(object):
...
@@ -288,117 +288,121 @@ class ScalabilityLauncher(object):
# Main loop
# Main loop
while
True
:
while
True
:
current_test
=
self
.
getRunningTest
()
current_test
=
self
.
getRunningTest
()
if
current_test
==
None
:
while
not
current_test
:
self
.
log
(
"No Test Case Ready"
)
time
.
sleep
(
15
)
else
:
current_test
=
self
.
getRunningTest
()
error_count
=
1
# Do not run a test while there are pending activities
waitFor0PendingActivities
(
self
.
__argumentNamespace
.
erp5_url
,
self
.
log
)
# Get the number of documents present before running the test.
previous_document_number
=
getCreatedDocumentNumberFromERP5
(
self
.
__argumentNamespace
.
erp5_url
,
self
.
log
)
self
.
log
(
"previous_document_number: %d"
%
previous_document_number
)
self
.
log
(
"Test Case %s is running..."
%
(
current_test
.
title
))
try
:
# Prepare command parameters
current_test_number
=
int
(
current_test
.
title
)
test_duration
=
suite
.
getTestDuration
(
current_test_number
)
benchmarks_path
=
os
.
path
.
join
(
self
.
__argumentNamespace
.
erp5_location
,
suite
.
getTestPath
())
user_file_full_path
=
os
.
path
.
join
(
self
.
__argumentNamespace
.
erp5_location
,
suite
.
getUsersFilePath
())
user_file_path
=
os
.
path
.
split
(
user_file_full_path
)[
0
]
user_file
=
os
.
path
.
split
(
user_file_full_path
)[
1
]
tester_path
=
self
.
__argumentNamespace
.
runner_path
user_number
=
suite
.
getUserNumber
(
current_test_number
)
self
.
log
(
"user_number: %s"
%
str
(
user_number
))
self
.
log
(
"test_duration: %ss"
%
str
(
test_duration
))
# Generate commands to run
command_list
=
[]
for
test_suite
in
test_suite_list
:
command_list
.
append
([
tester_path
,
self
.
__argumentNamespace
.
erp5_url
,
str
(
user_number
/
len
(
test_suite_list
)),
test_suite
,
'--benchmark-path-list'
,
benchmarks_path
,
'--users-file-path'
,
user_file_path
,
'--users-file'
,
user_file
,
'--filename-prefix'
,
"%s_%s_"
%
(
LOG_FILE_PREFIX
,
current_test
.
title
),
'--report-directory'
,
self
.
__argumentNamespace
.
log_path
,
'--repeat'
,
"%s"
%
str
(
MAX_DOCUMENTS
),
'--max-errors'
,
str
(
1000000
),
])
# Launch
tester_process_list
=
[]
for
command
in
command_list
:
self
.
log
(
"command: %s"
%
str
(
command
))
tester_process_list
.
append
(
subprocess
.
Popen
(
command
))
# Sleep
time
.
sleep
(
test_duration
)
# Stop
for
tester_process
in
tester_process_list
:
tester_process
.
send_signal
(
signal
.
SIGINT
)
# Ok
error_count
=
0
except
:
self
.
log
(
"Error during tester call."
)
error_count
=
1
raise
ValueError
(
"Tester call failed"
)
self
.
log
(
"Test Case %s is finish"
%
(
current_test
.
title
))
# Do not run a test while there are pending activities
self
.
log
(
"Going to count the number of created documents"
)
waitFor0PendingActivities
(
self
.
__argumentNamespace
.
erp5_url
,
self
.
log
)
# Get the number of documents present before running the test.
# Wait for 0 pending activities before counting
previous_document_number
=
getCreatedDocumentNumberFromERP5
(
self
.
__argumentNamespace
.
erp5_url
,
self
.
log
)
waitFor0PendingActivities
(
self
.
__argumentNamespace
.
erp5_url
,
self
.
log
)
self
.
log
(
"previous_document_number: %d"
%
previous_document_number
)
# Count created documents
self
.
log
(
"Test Case %s is running..."
%
(
current_test
.
title
))
current_document_number
=
getCreatedDocumentNumberFromERP5
(
self
.
__argumentNamespace
.
erp5_url
,
self
.
log
)
created_document_number
=
current_document_number
-
previous_document_number
try
:
self
.
log
(
"previous_document_number: %d"
%
previous_document_number
)
# Prepare command parameters
self
.
log
(
"current_document_number: %d"
%
current_document_number
)
current_test_number
=
int
(
current_test
.
title
)
self
.
log
(
"created_document_number: %d"
%
created_document_number
)
test_duration
=
suite
.
getTestDuration
(
current_test_number
)
created_document_per_hour_number
=
(
(
float
(
created_document_number
)
*
60
*
60
)
/
float
(
test_duration
)
)
benchmarks_path
=
os
.
path
.
join
(
self
.
__argumentNamespace
.
erp5_location
,
suite
.
getTestPath
())
user_file_full_path
=
os
.
path
.
join
(
self
.
__argumentNamespace
.
erp5_location
,
suite
.
getUsersFilePath
())
# Move csv/logs
user_file_path
=
os
.
path
.
split
(
user_file_full_path
)[
0
]
self
.
moveLogs
(
current_test
.
title
)
user_file
=
os
.
path
.
split
(
user_file_full_path
)[
1
]
tester_path
=
self
.
__argumentNamespace
.
runner_path
# Make a connection with ERP5 master
user_number
=
suite
.
getUserNumber
(
current_test_number
)
retry_time
=
2.0
proxy
=
taskdistribution
.
ServerProxy
(
self
.
log
(
"user_number: %s"
%
str
(
user_number
))
self
.
__argumentNamespace
.
test_suite_master_url
,
self
.
log
(
"test_duration: %ss"
%
str
(
test_duration
))
allow_none
=
True
).
portal_task_distribution
test_result_line_test
=
taskdistribution
.
TestResultLineProxy
(
proxy
,
retry_time
,
self
.
log
,
current_test
.
relative_path
,
current_test
.
title
)
# Generate output
results
=
"created docs=%d
\
n
"
\
"duration=%d
\
n
"
\
"number of tests=%d
\
n
"
\
%
(
created_document_number
,
test_duration
,
len
(
test_suite_list
)
)
self
.
log
(
"results: %s"
%
results
)
self
.
log
(
"%s doc in %s secs = %s docs per hour"
%
(
created_document_number
,
test_duration
,
created_document_per_hour_number
))
# Stop test case
# Generate commands to run
test_result_line_test
.
stop
(
stdout
=
results
,
command_list
=
[]
test_count
=
len
(
test_suite_list
),
user_index
=
0
error_count
=
error_count
,
for
test_suite
in
test_suite_list
:
duration
=
test_duration
)
command_list
.
append
([
tester_path
,
self
.
log
(
"Test Case Stopped"
)
self
.
__argumentNamespace
.
erp5_url
,
str
(
user_number
/
len
(
test_suite_list
)),
# Sleep between two loops
test_suite
,
time
.
sleep
(
5
)
'--benchmark-path-list'
,
benchmarks_path
,
'--users-file-path'
,
user_file_path
,
'--users-file'
,
user_file
,
'--filename-prefix'
,
"%s_%s_"
%
(
LOG_FILE_PREFIX
,
current_test
.
title
),
'--report-directory'
,
self
.
__argumentNamespace
.
log_path
,
'--repeat'
,
"%s"
%
str
(
MAX_DOCUMENTS
),
'--max-errors'
,
str
(
1000000
),
'--user-index'
,
str
(
user_index
),
])
user_index
+=
user_number
/
len
(
test_suite_list
)
# Launch
tester_process_list
=
[]
for
command
in
command_list
:
self
.
log
(
"command: %s"
%
str
(
command
))
tester_process_list
.
append
(
subprocess
.
Popen
(
command
))
# Sleep
time
.
sleep
(
test_duration
)
# Stop
for
tester_process
in
tester_process_list
:
tester_process
.
send_signal
(
signal
.
SIGINT
)
# Ok
error_count
=
0
except
:
self
.
log
(
"Error during tester call."
)
raise
ValueError
(
"Tester call failed"
)
self
.
log
(
"Test Case %s is finish"
%
(
current_test
.
title
))
self
.
log
(
"Going to count the number of created documents"
)
# Wait for 0 pending activities before counting
waitFor0PendingActivities
(
self
.
__argumentNamespace
.
erp5_url
,
self
.
log
)
# Count created documents
current_document_number
=
getCreatedDocumentNumberFromERP5
(
self
.
__argumentNamespace
.
erp5_url
,
self
.
log
)
created_document_number
=
current_document_number
-
previous_document_number
self
.
log
(
"previous_document_number: %d"
%
previous_document_number
)
self
.
log
(
"current_document_number: %d"
%
current_document_number
)
self
.
log
(
"created_document_number: %d"
%
created_document_number
)
created_document_per_hour_number
=
(
(
float
(
created_document_number
)
*
60
*
60
)
/
float
(
test_duration
)
)
# Move csv/logs
self
.
moveLogs
(
current_test
.
title
)
# Make a connection with ERP5 master
retry_time
=
2.0
proxy
=
taskdistribution
.
ServerProxy
(
self
.
__argumentNamespace
.
test_suite_master_url
,
allow_none
=
True
).
portal_task_distribution
test_result_line_test
=
taskdistribution
.
TestResultLineProxy
(
proxy
,
retry_time
,
self
.
log
,
current_test
.
relative_path
,
current_test
.
title
)
# Generate output
results
=
"created docs=%d
\
n
"
\
"duration=%d
\
n
"
\
"number of tests=%d
\
n
"
\
%
(
created_document_number
,
test_duration
,
len
(
test_suite_list
)
)
self
.
log
(
"results: %s"
%
results
)
self
.
log
(
"%s doc in %s secs = %s docs per hour"
%
(
created_document_number
,
test_duration
,
created_document_per_hour_number
))
# Stop test case
test_result_line_test
.
stop
(
stdout
=
results
,
test_count
=
len
(
test_suite_list
),
error_count
=
error_count
,
duration
=
test_duration
)
self
.
log
(
"Test Case Stopped"
)
return
error_message_set
,
exit_status
return
error_message_set
,
exit_status
def
main
():
def
main
():
...
...
erp5/util/taskdistribution/__init__.py
View file @
cc7c8b13
...
@@ -411,27 +411,11 @@ class TestResultProxyProxy(TestResultProxy):
...
@@ -411,27 +411,11 @@ class TestResultProxyProxy(TestResultProxy):
node_title
,
revision
)
node_title
,
revision
)
def
getRunningTestCase
(
self
):
def
getRunningTestCase
(
self
):
"""
"""
A proxy to getNextTestCase
A proxy to getNextTestCase
Return the relative path of the test with the running state
Return the relative path of the test with the running state
"""
"""
return
self
.
_retryRPC
(
'getRunningTestCase'
,
[
self
.
_test_result_path
])
return
self
.
_retryRPC
(
'getRunningTestCase'
,
[
self
.
_test_result_path
])
def
cancelTestCase
(
self
,
test_result_line_path
):
"""
"""
return
self
.
_retryRPC
(
'cancelTestCase'
,
[
test_result_line_path
])
def
stopTestCase
(
self
,
test_result_line_path
):
"""
"""
return
self
.
_retryRPC
(
'stopTestCase'
,
[
test_result_line_path
])
class
ServerProxy
(
xmlrpclib
.
ServerProxy
):
class
ServerProxy
(
xmlrpclib
.
ServerProxy
):
...
@@ -510,7 +494,6 @@ class TaskDistributionTool(RPCRetry):
...
@@ -510,7 +494,6 @@ class TaskDistributionTool(RPCRetry):
class
TaskDistributor
(
RPCRetry
):
class
TaskDistributor
(
RPCRetry
):
def
__init__
(
self
,
portal_url
,
retry_time
=
64
,
logger
=
None
):
def
__init__
(
self
,
portal_url
,
retry_time
=
64
,
logger
=
None
):
if
logger
is
None
:
if
logger
is
None
:
logger
=
null_logger
logger
=
null_logger
if
portal_url
is
None
:
if
portal_url
is
None
:
...
...
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