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
Mukul
erp5
Commits
577da5f3
Commit
577da5f3
authored
Dec 28, 2017
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
taskdistribution: style
parent
a0635286
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
20 deletions
+15
-20
erp5/util/taskdistribution/__init__.py
erp5/util/taskdistribution/__init__.py
+15
-20
No files found.
erp5/util/taskdistribution/__init__.py
View file @
577da5f3
...
@@ -39,9 +39,8 @@ Example use:
...
@@ -39,9 +39,8 @@ Example use:
# Run the test_line.name test
# Run the test_line.name test
test_line.stop()
test_line.stop()
"""
"""
from
__future__
import
print_function
import
httplib
import
httplib
import
logging
import
select
import
socket
import
socket
import
threading
import
threading
import
time
import
time
...
@@ -57,8 +56,8 @@ if xmlrpclib.ExpatParser and isinstance(parser, xmlrpclib.ExpatParser):
...
@@ -57,8 +56,8 @@ if xmlrpclib.ExpatParser and isinstance(parser, xmlrpclib.ExpatParser):
SAFE_RPC_EXCEPTION_LIST
.
append
(
xmlrpclib
.
expat
.
ExpatError
)
SAFE_RPC_EXCEPTION_LIST
.
append
(
xmlrpclib
.
expat
.
ExpatError
)
else
:
else
:
import
sys
import
sys
print
>>
sys
.
stderr
,
'Warning: unhandled xmlrpclib parser %r, some '
\
print
(
'Warning: unhandled xmlrpclib parser %r, some exceptions might get'
'exceptions might get through safeRpcCall'
%
(
parser
,
)
' through safeRpcCall'
%
parser
,
file
=
sys
.
stderr
)
del
sys
del
sys
SAFE_RPC_EXCEPTION_LIST
=
tuple
(
SAFE_RPC_EXCEPTION_LIST
)
SAFE_RPC_EXCEPTION_LIST
=
tuple
(
SAFE_RPC_EXCEPTION_LIST
)
del
parser
,
_
del
parser
,
_
...
@@ -110,7 +109,6 @@ def binarize_args(arg):
...
@@ -110,7 +109,6 @@ def binarize_args(arg):
class
RPCRetry
(
object
):
class
RPCRetry
(
object
):
def
__init__
(
self
,
proxy
,
retry_time
,
logger
):
def
__init__
(
self
,
proxy
,
retry_time
,
logger
):
super
(
RPCRetry
,
self
).
__init__
()
self
.
_proxy
=
proxy
self
.
_proxy
=
proxy
self
.
_retry_time
=
retry_time
self
.
_retry_time
=
retry_time
self
.
_logger
=
logger
self
.
_logger
=
logger
...
@@ -159,7 +157,8 @@ class TestResultLineProxy(RPCRetry):
...
@@ -159,7 +157,8 @@ class TestResultLineProxy(RPCRetry):
Tell if test result line is still alive on site.
Tell if test result line is still alive on site.
"""
"""
try
:
try
:
return
bool
(
self
.
_retryRPC
(
'isTestCaseAlive'
,
[
self
.
_test_result_line_path
]))
return
bool
(
self
.
_retryRPC
(
'isTestCaseAlive'
,
(
self
.
_test_result_line_path
,)))
except
:
except
:
raise
ValueError
(
'isTestCaseAlive Failed.'
)
raise
ValueError
(
'isTestCaseAlive Failed.'
)
...
@@ -222,6 +221,7 @@ class TestResultProxy(RPCRetry):
...
@@ -222,6 +221,7 @@ class TestResultProxy(RPCRetry):
self
.
_watcher_period
=
60
self
.
_watcher_period
=
60
self
.
_watcher_dict
=
{}
self
.
_watcher_dict
=
{}
self
.
_watcher_condition
=
threading
.
Condition
()
self
.
_watcher_condition
=
threading
.
Condition
()
def
__repr__
(
self
):
def
__repr__
(
self
):
return
'<%s(%r, %r, %r) at %x>'
%
(
self
.
__class__
.
__name__
,
return
'<%s(%r, %r, %r) at %x>'
%
(
self
.
__class__
.
__name__
,
self
.
_test_result_path
,
self
.
_node_title
,
self
.
_revision
,
id
(
self
))
self
.
_test_result_path
,
self
.
_node_title
,
self
.
_revision
,
id
(
self
))
...
@@ -381,10 +381,9 @@ class TestResultProxy(RPCRetry):
...
@@ -381,10 +381,9 @@ class TestResultProxy(RPCRetry):
def
stop
(
self
):
def
stop
(
self
):
"""
"""
"""
"""
return
self
.
_retryRPC
(
'stopTest'
,
[
self
.
_test_result_path
])
return
self
.
_retryRPC
(
'stopTest'
,
[
self
.
_test_result_path
])
def
getRunningTestCase
(
self
):
def
getRunningTestCase
(
self
):
"""
"""
Return the relative path of the next test with the running state
Return the relative path of the next test with the running state
...
@@ -409,41 +408,37 @@ class ServerProxy(xmlrpclib.ServerProxy):
...
@@ -409,41 +408,37 @@ class ServerProxy(xmlrpclib.ServerProxy):
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
:
proxy
=
DummyTaskDistributor
()
proxy
=
DummyTaskDistributor
()
else
:
else
:
proxy
=
ServerProxy
(
portal_url
,
allow_none
=
True
)
proxy
=
ServerProxy
(
portal_url
,
allow_none
=
True
)
super
(
TaskDistributor
,
self
).
__init__
(
proxy
,
retry_time
,
logger
)
super
(
TaskDistributor
,
self
).
__init__
(
proxy
,
retry_time
,
logger
)
protocol_revision
=
self
.
_retryRPC
(
'getProtocolRevision'
)
protocol_revision
=
self
.
_retryRPC
(
'getProtocolRevision'
)
if
protocol_revision
!=
1
:
if
protocol_revision
!=
1
:
raise
ValueError
(
'Unsupported protocol revision: %r'
,
raise
ValueError
(
'Unsupported protocol revision: %r'
,
protocol_revision
)
protocol_revision
)
def
startTestSuite
(
self
,
node_title
,
computer_guid
=
'unknown'
):
def
startTestSuite
(
self
,
node_title
,
computer_guid
=
'unknown'
):
"""
"""
Returns None if no test suite is needed.
Returns None if no test suite is needed.
therwise, returns a JSON with all the test suite parameters.
therwise, returns a JSON with all the test suite parameters.
"""
"""
result
=
self
.
_retryRPC
(
'startTestSuite'
,(
node_title
,
computer_guid
,))
return
self
.
_retryRPC
(
'startTestSuite'
,
(
node_title
,
computer_guid
))
return
result
def
getTestType
(
self
):
def
getTestType
(
self
):
"""
"""
Return the Test Type
Return the Test Type
"""
"""
result
=
self
.
_retryRPC
(
'getTestType'
)
return
self
.
_retryRPC
(
'getTestType'
)
return
result
def
subscribeNode
(
self
,
node_title
,
computer_guid
):
def
subscribeNode
(
self
,
node_title
,
computer_guid
):
"""
"""
Susbscribes node with the node title and the computer guid.
Susbscribes node with the node title and the computer guid.
"""
"""
result
=
self
.
_retryRPC
(
'subscribeNode'
,
(
node_title
,
computer_guid
,))
return
self
.
_retryRPC
(
'subscribeNode'
,
(
node_title
,
computer_guid
))
return
result
def
generateConfiguration
(
self
,
test_suite_title
):
def
generateConfiguration
(
self
,
test_suite_title
):
"""
"""
...
@@ -463,7 +458,7 @@ class TaskDistributor(RPCRetry):
...
@@ -463,7 +458,7 @@ class TaskDistributor(RPCRetry):
Returns the slapos account key related to the distributor
Returns the slapos account key related to the distributor
"""
"""
return
self
.
_retryRPC
(
'getSlaposAccountKey'
)
return
self
.
_retryRPC
(
'getSlaposAccountKey'
)
def
getSlaposAccountCertificate
(
self
):
def
getSlaposAccountCertificate
(
self
):
"""
"""
Returns the slapos account certificate related to the distributor
Returns the slapos account certificate related to the distributor
...
@@ -475,7 +470,7 @@ class TaskDistributor(RPCRetry):
...
@@ -475,7 +470,7 @@ class TaskDistributor(RPCRetry):
Returns the url of slapos master related to the distributor
Returns the url of slapos master related to the distributor
"""
"""
return
self
.
_retryRPC
(
'getSlaposUrl'
)
return
self
.
_retryRPC
(
'getSlaposUrl'
)
def
getSlaposHateoasUrl
(
self
):
def
getSlaposHateoasUrl
(
self
):
"""
"""
Returns the url of API REST using hateoas of
Returns the url of API REST using hateoas of
...
...
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