Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
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
Yusei Tahara
slapos
Commits
a1bd038f
Commit
a1bd038f
authored
Jun 14, 2011
by
Sebastien Robin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'erp5testnode'
parents
fcdb035e
a2f0c1df
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
61 deletions
+57
-61
slapos/recipe/erp5testnode/SlapOSControler.py
slapos/recipe/erp5testnode/SlapOSControler.py
+35
-31
slapos/recipe/erp5testnode/testnode.py
slapos/recipe/erp5testnode/testnode.py
+22
-30
No files found.
slapos/recipe/erp5testnode/SlapOSControler.py
View file @
a1bd038f
...
@@ -46,45 +46,49 @@ class SlapOSControler(object):
...
@@ -46,45 +46,49 @@ class SlapOSControler(object):
'reference'
:
config
[
'computer_id'
],
'reference'
:
config
[
'computer_id'
],
'software_root'
:
config
[
'software_root'
]}))
'software_root'
:
config
[
'software_root'
]}))
def
runSoftwareRelease
(
self
,
config
,
environment
,
process_group_pid_set
=
None
):
def
runSoftwareRelease
(
self
,
config
,
environment
,
process_group_pid_set
=
None
,
stdout
=
None
,
stderr
=
None
):
print
"SlapOSControler.runSoftwareRelease"
print
"SlapOSControler.runSoftwareRelease"
while
True
:
cpu_count
=
os
.
sysconf
(
"SC_NPROCESSORS_ONLN"
)
cpu_count
=
os
.
sysconf
(
"SC_NPROCESSORS_ONLN"
)
os
.
putenv
(
'MAKEFLAGS'
,
'-j%s'
%
cpu_count
)
os
.
putenv
(
'MAKEFLAGS'
,
'-j%s'
%
cpu_count
)
os
.
environ
[
'PATH'
]
=
environment
[
'PATH'
]
os
.
environ
[
'PATH'
]
=
environment
[
'PATH'
]
slapgrid
=
subprocess
.
Popen
([
config
[
'slapgrid_software_binary'
],
'-v'
,
'-c'
,
stdout
=
open
(
os
.
path
.
join
(
#'--buildout-parameter',"'-U -N' -o",
config
[
'instance_root'
],
'.runSoftwareRelease_out'
),
config
[
'slapos_config'
]],
'w+'
)
stdout
=
stdout
,
stderr
=
stderr
,
stderr
=
open
(
os
.
path
.
join
(
close_fds
=
True
,
preexec_fn
=
os
.
setsid
)
config
[
'instance_root'
],
'.runSoftwareRelease_err'
),
process_group_pid_set
.
add
(
slapgrid
.
pid
)
'w+'
)
slapgrid
.
wait
()
slapgrid
=
subprocess
.
Popen
([
config
[
'slapgrid_software_binary'
],
'-v'
,
'-c'
,
stdout
.
seek
(
0
)
#'--buildout-parameter',"'-U -N' -o",
stderr
.
seek
(
0
)
config
[
'slapos_config'
]],
process_group_pid_set
.
remove
(
slapgrid
.
pid
)
stdout
=
stdout
,
stderr
=
stderr
,
status_dict
=
{
'status_code'
:
slapgrid
.
returncode
,
close_fds
=
True
,
preexec_fn
=
os
.
setsid
)
'stdout'
:
stdout
.
read
(),
process_group_pid_set
.
add
(
slapgrid
.
pid
)
'stderr'
:
stderr
.
read
()}
slapgrid
.
wait
()
stdout
.
close
()
stdout
.
seek
(
0
)
stderr
.
close
()
stderr
.
seek
(
0
)
return
status_dict
process_group_pid_set
.
remove
(
slapgrid
.
pid
)
status_dict
=
{
'status_code'
:
slapgrid
.
returncode
,
'stdout'
:
stdout
.
read
(),
'stderr'
:
stderr
.
read
()}
stdout
.
close
()
stderr
.
close
()
return
status_dict
def
runComputerPartition
(
self
,
config
,
process_group_pid_set
=
None
):
def
runComputerPartition
(
self
,
config
,
environment
,
process_group_pid_set
=
None
,
stdout
=
None
,
stderr
=
None
):
print
"SlapOSControler.runSoftwareRelease"
print
"SlapOSControler.runSoftwareRelease"
slap
=
slapos
.
slap
.
slap
()
slap
=
slapos
.
slap
.
slap
()
slap
.
registerOpenOrder
().
request
(
self
.
software_profile
,
slap
.
registerOpenOrder
().
request
(
self
.
software_profile
,
partition_reference
=
'testing partition'
,
partition_reference
=
'testing partition'
,
partition_parameter_kw
=
config
[
'instance_dict'
])
partition_parameter_kw
=
config
[
'instance_dict'
])
slapgrid
=
subprocess
.
Popen
([
config
[
'slapgrid_partition_binary'
],
slapgrid
=
subprocess
.
Popen
([
config
[
'slapgrid_partition_binary'
],
config
[
'slapos_config'
],
'-c'
,
'-v'
],
close_fds
=
True
,
preexec_fn
=
os
.
setsid
)
config
[
'slapos_config'
],
'-c'
,
'-v'
],
stdout
=
stdout
,
stderr
=
stderr
,
close_fds
=
True
,
preexec_fn
=
os
.
setsid
)
process_group_pid_set
.
add
(
slapgrid
.
pid
)
process_group_pid_set
.
add
(
slapgrid
.
pid
)
slapgrid
.
wait
()
slapgrid
.
wait
()
stdout
.
seek
(
0
)
stderr
.
seek
(
0
)
process_group_pid_set
.
remove
(
slapgrid
.
pid
)
process_group_pid_set
.
remove
(
slapgrid
.
pid
)
if
slapgrid
.
returncode
!=
0
:
status_dict
=
{
'status_code'
:
slapgrid
.
returncode
,
raise
ValueError
(
'Slapgrid instance failed'
)
'stdout'
:
stdout
.
read
(),
'stderr'
:
stderr
.
read
()}
stdout
.
close
()
stderr
.
close
()
return
status_dict
slapos/recipe/erp5testnode/testnode.py
View file @
a1bd038f
...
@@ -55,6 +55,16 @@ def safeRpcCall(function, *args):
...
@@ -55,6 +55,16 @@ def safeRpcCall(function, *args):
time
.
sleep
(
retry
)
time
.
sleep
(
retry
)
retry
+=
retry
>>
1
retry
+=
retry
>>
1
def
getInputOutputFileList
(
config
,
command_name
):
stdout
=
open
(
os
.
path
.
join
(
config
[
'instance_root'
],
'.%s_out'
%
command_name
),
'w+'
)
stdout
.
write
(
"%s
\
n
"
%
command_name
)
stderr
=
open
(
os
.
path
.
join
(
config
[
'instance_root'
],
'.%s_err'
%
command_name
),
'w+'
)
return
(
stdout
,
stderr
)
slapos_controler
=
None
slapos_controler
=
None
def
run
(
args
):
def
run
(
args
):
...
@@ -168,42 +178,25 @@ branch = %(branch)s
...
@@ -168,42 +178,25 @@ branch = %(branch)s
revision
=
repository_revision
.
split
(
'-'
)[
1
])
revision
=
repository_revision
.
split
(
'-'
)[
1
])
updater
.
checkout
()
updater
.
checkout
()
# Now prepare the installation of SlapOS
# Now prepare the installation of SlapOS
and create instance
slapos_controler
=
SlapOSControler
(
config
,
slapos_controler
=
SlapOSControler
(
config
,
process_group_pid_set
=
process_group_pid_set
)
process_group_pid_set
=
process_group_pid_set
)
# this should be always true later, but it is too slow for now
for
method_name
in
(
"runSoftwareRelease"
,
"runComputerPartition"
):
status_dict
=
slapos_controler
.
runSoftwareRelease
(
config
,
stdout
,
stderr
=
getInputOutputFileList
(
config
,
method_name
)
environment
=
config
[
'environment'
],
slapos_method
=
getattr
(
slapos_controler
,
method_name
)
process_group_pid_set
=
process_group_pid_set
,
status_dict
=
slapos_method
(
config
,
)
environment
=
config
[
'environment'
],
process_group_pid_set
=
process_group_pid_set
,
stdout
=
stdout
,
stderr
=
stderr
)
if
status_dict
[
'status_code'
]
!=
0
:
break
if
status_dict
[
'status_code'
]
!=
0
:
if
status_dict
[
'status_code'
]
!=
0
:
safeRpcCall
(
master
.
reportTaskFailure
,
safeRpcCall
(
master
.
reportTaskFailure
,
test_result_path
,
status_dict
,
config
[
'test_node_title'
])
test_result_path
,
status_dict
,
config
[
'test_node_title'
])
retry_software
=
True
retry_software
=
True
continue
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
# The section below seems useless since we override buildout
# configuration to use local checkouts
#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'],
#revision=revision)
#updater.checkout()
partition_path
=
os
.
path
.
join
(
config
[
'instance_root'
],
partition_path
=
os
.
path
.
join
(
config
[
'instance_root'
],
config
[
'partition_reference'
])
config
[
'partition_reference'
])
run_test_suite_path
=
os
.
path
.
join
(
partition_path
,
'bin'
,
run_test_suite_path
=
os
.
path
.
join
(
partition_path
,
'bin'
,
...
@@ -249,5 +242,4 @@ branch = %(branch)s
...
@@ -249,5 +242,4 @@ branch = %(branch)s
if
os
.
path
.
exists
(
supervisord_pid_file
):
if
os
.
path
.
exists
(
supervisord_pid_file
):
os
.
kill
(
int
(
open
(
supervisord_pid_file
).
read
().
strip
()),
signal
.
SIGTERM
)
os
.
kill
(
int
(
open
(
supervisord_pid_file
).
read
().
strip
()),
signal
.
SIGTERM
)
except
:
except
:
pass
pass
\ No newline at end of file
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