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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Hardik Juneja
erp5
Commits
203a89b0
Commit
203a89b0
authored
Feb 14, 2012
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
All XML-RPC methods must be executed within *safe* method which allows
restart if task distribution node is down. Refactor.
parent
e267ed79
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
+9
-6
erp5/util/testnode/testnode.py
erp5/util/testnode/testnode.py
+9
-6
No files found.
erp5/util/testnode/testnode.py
View file @
203a89b0
...
...
@@ -34,6 +34,9 @@ import time
import
xmlrpclib
import
glob
import
SlapOSControler
import
logging
DEFAULT_SLEEP_TIMEOUT
=
120
# time in seconds to sleep
class
SubprocessError
(
EnvironmentError
):
def
__init__
(
self
,
status_dict
):
...
...
@@ -43,7 +46,6 @@ class SubprocessError(EnvironmentError):
def
__str__
(
self
):
return
'Error %i'
%
self
.
status_code
from
Updater
import
Updater
supervisord_pid_file
=
None
...
...
@@ -58,8 +60,9 @@ def sigterm_handler(signal, frame):
signal
.
signal
(
signal
.
SIGTERM
,
sigterm_handler
)
import
logging
def
safeRpcCall
(
function
,
*
args
):
# XXX: this method will try infinitive calls to backend
# this can cause testnode to looked "stalled"
retry
=
64
while
True
:
try
:
...
...
@@ -188,7 +191,7 @@ branch = %(branch)s
revision
=
','
.
join
(
full_revision_list
)
if
previous_revision
==
revision
:
log
(
'Sleeping a bit'
)
time
.
sleep
(
120
)
time
.
sleep
(
DEFAULT_SLEEP_TIMEOUT
)
if
not
(
retry_software
):
continue
log
(
'Retrying install'
)
...
...
@@ -204,7 +207,7 @@ branch = %(branch)s
portal
=
xmlrpclib
.
ServerProxy
(
"%s%s"
%
(
portal_url
,
'portal_task_distribution'
),
allow_none
=
1
)
master
=
portal
.
portal_task_distribution
master
=
portal
assert
safeRpcCall
(
master
.
getProtocolRevision
)
==
1
test_result
=
safeRpcCall
(
master
.
createTestResult
,
config
[
'test_suite'
],
revision
,
[],
...
...
@@ -235,7 +238,7 @@ branch = %(branch)s
slapos_controler
=
SlapOSControler
.
SlapOSControler
(
config
,
process_group_pid_set
=
process_group_pid_set
,
log
=
log
,
slapproxy_log
=
slapproxy_log
)
for
method_name
in
(
"runSoftwareRelease"
,
"runComputerPartition"
):
for
method_name
in
(
"runSoftwareRelease"
,
"runComputerPartition"
,
):
stdout
,
stderr
=
getInputOutputFileList
(
config
,
method_name
)
slapos_method
=
getattr
(
slapos_controler
,
method_name
)
status_dict
=
slapos_method
(
config
,
...
...
@@ -288,7 +291,7 @@ branch = %(branch)s
if
remote_test_result_needs_cleanup
:
safeRpcCall
(
master
.
reportTaskFailure
,
test_result_path
,
e
.
status_dict
,
config
[
'test_node_title'
])
time
.
sleep
(
120
)
time
.
sleep
(
DEFAULT_SLEEP_TIMEOUT
)
continue
finally
:
...
...
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