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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Romain Courteaud
erp5
Commits
8f841588
Commit
8f841588
authored
5 years ago
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ERP5] TaskDistribution: start a random test instead of looking for the smaller int_index
This prevent getting DB read/write conflicts
parent
13ca58b1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
6 deletions
+14
-6
product/ERP5/Tool/TaskDistributionTool.py
product/ERP5/Tool/TaskDistributionTool.py
+14
-6
No files found.
product/ERP5/Tool/TaskDistributionTool.py
View file @
8f841588
...
...
@@ -231,18 +231,26 @@ class TaskDistributionTool(BaseTool):
if
test_result
.
getSimulationState
()
!=
'started'
:
return
started_list
=
[]
for
line
in
test_result
.
objectValues
(
portal_type
=
"Test Result Line"
,
sort_on
=
[(
"int_index"
,
"ascending"
)]):
# Look for a test to run
# As many nodes may call this function at the same time,
# fetching all lines will create read/write DB conflicts
# To prevent this, randomize the list of documents to check
# and stop as soon as one test to run is found
line_id_list
=
[
x
for
x
in
test_result
.
objectIds
()]
random
.
shuffle
(
line_id_list
)
for
line_id
in
line_id_list
:
line
=
test_result
[
line_id
]
if
(
line
.
getPortalType
()
!=
'Test Result Line'
):
continue
test
=
line
.
getTitle
()
if
test
not
in
exclude_list
:
state
=
line
.
getSimulationState
()
test
=
line
.
getRelativeUrl
(),
test
if
state
==
'draft'
:
if
line
.
getSimulationState
()
==
'draft'
:
if
node_title
:
node
=
self
.
_getTestNodeRelativeUrl
(
node_title
)
line
.
setSource
(
node
)
line
.
start
()
return
test
return
line
.
getRelativeUrl
(),
test
security
.
declarePublic
(
'stopUnitTest'
)
def
stopUnitTest
(
self
,
test_path
,
status_dict
,
node_title
=
None
):
...
...
This diff is collapsed.
Click to expand it.
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