Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.toolbox
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
Guillaume Hervier
slapos.toolbox
Commits
d3cd5e31
Commit
d3cd5e31
authored
Aug 31, 2012
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement much more network tolerant RPC call.
parent
9bc65393
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
10 deletions
+7
-10
slapos/agent/agent.py
slapos/agent/agent.py
+7
-10
No files found.
slapos/agent/agent.py
View file @
d3cd5e31
...
@@ -14,6 +14,7 @@ import slapos.slap
...
@@ -14,6 +14,7 @@ import slapos.slap
from
slapos.grid.utils
import
setRunning
,
setFinished
from
slapos.grid.utils
import
setRunning
,
setFinished
from
erp5.util.taskdistribution
import
TaskDistributionTool
,
RPCRetry
from
erp5.util.taskdistribution
import
TaskDistributionTool
,
RPCRetry
from
erp5.util.taskdistribution
import
SAFE_RPC_EXCEPTION_LIST
from
erp5.util.taskdistribution
import
SAFE_RPC_EXCEPTION_LIST
class
AutoSTemp
(
object
):
class
AutoSTemp
(
object
):
"""
"""
Create a self-destructing temporary file.
Create a self-destructing temporary file.
...
@@ -95,29 +96,25 @@ class x509Transport(xmlrpclib.Transport):
...
@@ -95,29 +96,25 @@ class x509Transport(xmlrpclib.Transport):
class
TestTimeout
(
Exception
):
class
TestTimeout
(
Exception
):
pass
pass
MAX_RETRY_ON_NETWORK_FAILURE
=
10
DELAY_BETWEEN_RETRY
=
10
# Simple decorator to prevent raise due small
# Simple decorator to prevent raise due small
# network failures.
# network failures.
def
retryOnNetworkFailure
(
func
):
def
retryOnNetworkFailure
(
func
):
def
wrapper
(
*
args
,
**
kwargs
):
def
wrapper
(
*
args
,
**
kwargs
):
for
count
in
range
(
MAX_RETRY_ON_NETWORK_FAILURE
):
retry_time
=
64
while
True
:
try
:
try
:
return
func
(
*
args
,
**
kwargs
)
return
func
(
*
args
,
**
kwargs
)
except
SAFE_RPC_EXCEPTION_LIST
,
e
:
except
SAFE_RPC_EXCEPTION_LIST
,
e
:
print
"Network failure (%s): %s , %s"
%
(
count
,
sys
.
exc_info
(),
e
)
print
'Network failure: %s , %s'
%
(
sys
.
exc_info
(),
e
)
time
.
sleep
(
DELAY_BETWEEN_RETRY
)
# Last try should raise normally
print
'Retry method %s in %i seconds'
%
(
func
,
retry_time
)
return
func
(
*
args
,
**
kwargs
)
time
.
sleep
(
retry_time
)
retry_time
+=
retry_time
>>
1
wrapper
.
__name__
=
func
.
__name__
wrapper
.
__name__
=
func
.
__name__
wrapper
.
__doc__
=
func
.
__doc__
wrapper
.
__doc__
=
func
.
__doc__
return
wrapper
return
wrapper
class
SoftwareReleaseTester
(
RPCRetry
):
class
SoftwareReleaseTester
(
RPCRetry
):
deadline
=
None
deadline
=
None
latest_state
=
None
latest_state
=
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