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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Douglas
erp5
Commits
516ab724
Commit
516ab724
authored
May 20, 2011
by
Sebastien Robin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
handle network failures when getting repository source code
parent
af519422
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
112 additions
and
108 deletions
+112
-108
slapos/recipe/erp5.recipe.testnode/setup.py
slapos/recipe/erp5.recipe.testnode/setup.py
+1
-1
slapos/recipe/erp5.recipe.testnode/src/erp5/recipe/testnode/testnode.py
...erp5.recipe.testnode/src/erp5/recipe/testnode/testnode.py
+111
-107
No files found.
slapos/recipe/erp5.recipe.testnode/setup.py
View file @
516ab724
from
setuptools
import
setup
,
find_packages
from
setuptools
import
setup
,
find_packages
name
=
"erp5.recipe.testnode"
name
=
"erp5.recipe.testnode"
version
=
'1.0.2
2
'
version
=
'1.0.2
3
'
def
read
(
name
):
def
read
(
name
):
return
open
(
name
).
read
()
return
open
(
name
).
read
()
...
...
slapos/recipe/erp5.recipe.testnode/src/erp5/recipe/testnode/testnode.py
View file @
516ab724
...
@@ -97,115 +97,119 @@ repository = %(repository_path)s
...
@@ -97,115 +97,119 @@ repository = %(repository_path)s
try
:
try
:
while
True
:
while
True
:
# kill processes from previous loop if any
# kill processes from previous loop if any
for
pgpid
in
process_group_pid_set
:
try
:
try
:
for
pgpid
in
process_group_pid_set
:
os
.
killpg
(
pgpid
,
signal
.
SIGTERM
)
try
:
except
:
os
.
killpg
(
pgpid
,
signal
.
SIGTERM
)
pass
except
:
process_group_pid_set
.
clear
()
pass
# Make sure we have local repository
process_group_pid_set
.
clear
()
if
not
os
.
path
.
exists
(
repository_path
):
# Make sure we have local repository
parameter_list
=
[
config
[
'git_binary'
],
'clone'
,
if
not
os
.
path
.
exists
(
repository_path
):
config
[
'vcs_repository'
]]
parameter_list
=
[
config
[
'git_binary'
],
'clone'
,
if
branch
is
not
None
:
config
[
'vcs_repository'
]]
parameter_list
.
extend
([
'-b'
,
branch
])
if
branch
is
not
None
:
parameter_list
.
append
(
repository_path
)
parameter_list
.
extend
([
'-b'
,
branch
])
subprocess
.
check_call
(
parameter_list
)
parameter_list
.
append
(
repository_path
)
# XXX this looks like to not wait the end of the command
subprocess
.
check_call
(
parameter_list
)
# Make sure we have local repository
# XXX this looks like to not wait the end of the command
updater
=
Updater
(
repository_path
,
git_binary
=
config
[
'git_binary'
])
# Make sure we have local repository
updater
.
checkout
()
updater
=
Updater
(
repository_path
,
git_binary
=
config
[
'git_binary'
])
revision
=
updater
.
getRevision
()
updater
.
checkout
()
if
previous_revision
==
revision
:
revision
=
updater
.
getRevision
()
time
.
sleep
(
120
)
if
previous_revision
==
revision
:
if
not
(
retry_software
):
time
.
sleep
(
120
)
continue
if
not
(
retry_software
):
retry_software
=
False
continue
previous_revision
=
revision
retry_software
=
False
previous_revision
=
revision
print
config
portal_url
=
config
[
'test_suite_master_url'
]
print
config
test_result_path
=
None
portal_url
=
config
[
'test_suite_master_url'
]
test_result
=
(
test_result_path
,
revision
)
test_result_path
=
None
if
portal_url
:
test_result
=
(
test_result_path
,
revision
)
if
portal_url
[
-
1
]
!=
'/'
:
if
portal_url
:
portal_url
+=
'/'
if
portal_url
[
-
1
]
!=
'/'
:
portal
=
xmlrpclib
.
ServerProxy
(
"%s%s"
%
portal_url
+=
'/'
(
portal_url
,
'portal_task_distribution'
),
portal
=
xmlrpclib
.
ServerProxy
(
"%s%s"
%
allow_none
=
1
)
(
portal_url
,
'portal_task_distribution'
),
master
=
portal
.
portal_task_distribution
allow_none
=
1
)
assert
master
.
getProtocolRevision
()
==
1
master
=
portal
.
portal_task_distribution
test_result
=
safeRpcCall
(
master
.
createTestResult
,
assert
master
.
getProtocolRevision
()
==
1
config
[
'test_suite_name'
],
revision
,
[],
test_result
=
safeRpcCall
(
master
.
createTestResult
,
False
,
config
[
'test_suite_title'
])
config
[
'test_suite_name'
],
revision
,
[],
print
"testnode, test_result : %r"
%
(
test_result
,)
False
,
config
[
'test_suite_title'
])
if
test_result
:
print
"testnode, test_result : %r"
%
(
test_result
,)
test_result_path
,
test_revision
=
test_result
if
test_result
:
if
revision
!=
test_revision
:
test_result_path
,
test_revision
=
test_result
# other testnodes on other boxes are already ready to test another
if
revision
!=
test_revision
:
# revision
# other testnodes on other boxes are already ready to test another
updater
=
Updater
(
repository_path
,
git_binary
=
config
[
'git_binary'
],
# revision
revision
=
test_revision
)
updater
.
checkout
()
# Now prepare the installation of SlapOS
slapos_controler
=
SlapOSControler
(
config
,
process_group_pid_set
=
process_group_pid_set
)
# this should be always true later, but it is too slow for now
status_dict
=
slapos_controler
.
runSoftwareRelease
(
config
,
environment
=
config
[
'environment'
],
process_group_pid_set
=
process_group_pid_set
,
)
if
status_dict
[
'status_code'
]
!=
0
:
safeRpcCall
(
master
.
reportTaskFailure
,
test_result_path
,
status_dict
,
config
[
'test_suite_title'
])
retry_software
=
True
continue
# create instances, it should take some seconds only
slapos_controler
.
runComputerPartition
(
config
,
process_group_pid_set
=
process_group_pid_set
)
# update repositories downloaded by buildout. Later we should get
# from master a list of repositories
repository_path_list
=
glob
(
os
.
path
.
join
(
config
[
'software_root'
],
'*'
,
'parts'
,
'git_repository'
,
'*'
))
assert
len
(
repository_path_list
)
>=
0
for
repository_path
in
repository_path_list
:
updater
=
Updater
(
repository_path
,
git_binary
=
config
[
'git_binary'
])
updater
.
checkout
()
if
os
.
path
.
split
(
repository_path
)[
-
1
]
==
repository_name
:
# redo checkout with good revision, the previous one is used
# to pull last code
updater
=
Updater
(
repository_path
,
git_binary
=
config
[
'git_binary'
],
updater
=
Updater
(
repository_path
,
git_binary
=
config
[
'git_binary'
],
revision
=
revision
)
revision
=
test_
revision
)
updater
.
checkout
()
updater
.
checkout
()
# calling dist/externals is only there for backward compatibility,
# the code will be removed soon
# Now prepare the installation of SlapOS
if
os
.
path
.
exists
(
os
.
path
.
join
(
repository_path
,
'dist/externals.py'
)):
slapos_controler
=
SlapOSControler
(
config
,
process
=
subprocess
.
Popen
([
'dist/externals.py'
],
process_group_pid_set
=
process_group_pid_set
)
cwd
=
repository_path
)
# this should be always true later, but it is too slow for now
process
.
wait
()
status_dict
=
slapos_controler
.
runSoftwareRelease
(
config
,
environment
=
config
[
'environment'
],
partition_path
=
os
.
path
.
join
(
config
[
'instance_root'
],
process_group_pid_set
=
process_group_pid_set
,
config
[
'partition_reference'
])
)
run_test_suite_path
=
os
.
path
.
join
(
partition_path
,
'bin'
,
if
status_dict
[
'status_code'
]
!=
0
:
'runTestSuite'
)
safeRpcCall
(
master
.
reportTaskFailure
,
if
not
os
.
path
.
exists
(
run_test_suite_path
):
test_result_path
,
status_dict
,
config
[
'test_suite_title'
])
raise
ValueError
(
'No %r provided'
%
run_test_suite_path
)
retry_software
=
True
continue
run_test_suite_revision
=
revision
if
isinstance
(
revision
,
tuple
):
# create instances, it should take some seconds only
revision
=
','
.
join
(
revision
)
slapos_controler
.
runComputerPartition
(
config
,
run_test_suite
=
subprocess
.
Popen
([
run_test_suite_path
,
process_group_pid_set
=
process_group_pid_set
)
'--test_suite'
,
config
[
'test_suite_name'
],
'--revision'
,
revision
,
# update repositories downloaded by buildout. Later we should get
'--node_quantity'
,
config
[
'node_quantity'
],
# from master a list of repositories
'--master_url'
,
config
[
'test_suite_master_url'
],
repository_path_list
=
glob
(
os
.
path
.
join
(
config
[
'software_root'
],
],
)
'*'
,
'parts'
,
'git_repository'
,
'*'
))
process_group_pid_set
.
add
(
run_test_suite
.
pid
)
assert
len
(
repository_path_list
)
>=
0
run_test_suite
.
wait
()
for
repository_path
in
repository_path_list
:
process_group_pid_set
.
remove
(
run_test_suite
.
pid
)
updater
=
Updater
(
repository_path
,
git_binary
=
config
[
'git_binary'
])
updater
.
checkout
()
if
os
.
path
.
split
(
repository_path
)[
-
1
]
==
repository_name
:
# redo checkout with good revision, the previous one is used
# to pull last code
updater
=
Updater
(
repository_path
,
git_binary
=
config
[
'git_binary'
],
revision
=
revision
)
updater
.
checkout
()
# calling dist/externals is only there for backward compatibility,
# the code will be removed soon
if
os
.
path
.
exists
(
os
.
path
.
join
(
repository_path
,
'dist/externals.py'
)):
process
=
subprocess
.
Popen
([
'dist/externals.py'
],
cwd
=
repository_path
)
process
.
wait
()
partition_path
=
os
.
path
.
join
(
config
[
'instance_root'
],
config
[
'partition_reference'
])
run_test_suite_path
=
os
.
path
.
join
(
partition_path
,
'bin'
,
'runTestSuite'
)
if
not
os
.
path
.
exists
(
run_test_suite_path
):
raise
ValueError
(
'No %r provided'
%
run_test_suite_path
)
run_test_suite_revision
=
revision
if
isinstance
(
revision
,
tuple
):
revision
=
','
.
join
(
revision
)
run_test_suite
=
subprocess
.
Popen
([
run_test_suite_path
,
'--test_suite'
,
config
[
'test_suite_name'
],
'--revision'
,
revision
,
'--node_quantity'
,
config
[
'node_quantity'
],
'--master_url'
,
config
[
'test_suite_master_url'
],
],
)
process_group_pid_set
.
add
(
run_test_suite
.
pid
)
run_test_suite
.
wait
()
process_group_pid_set
.
remove
(
run_test_suite
.
pid
)
except
SubprocessError
:
time
.
sleep
(
120
)
continue
finally
:
finally
:
# Nice way to kill *everything* generated by run process -- process
# Nice way to kill *everything* generated by run process -- process
...
...
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