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
Kasra Jamshidi
slapos
Commits
139cb718
Commit
139cb718
authored
Jun 14, 2011
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into erp5
parents
f443b0f8
6c31c42f
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
71 additions
and
63 deletions
+71
-63
CHANGES.txt
CHANGES.txt
+13
-1
setup.py
setup.py
+1
-1
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.
CHANGES.txt
View file @
139cb718
0.
6
(unreleased)
0.
8
(unreleased)
================
================
* No changes yet.
* No changes yet.
0.7 (2011-06-14)
================
* Fix slapos.recipe.erp5 package by providing site.zcml in it. [Łukasz Nowak]
* Improve slapos.recipe.erp5testnode partition instantiation error reporting
[Sebastien Robin]
0.6 (2011-06-13)
================
* Fixed slapos.recipe.erp5 instantiation. [Łukasz Nowak]
0.5 (2011-06-13)
0.5 (2011-06-13)
================
================
...
...
setup.py
View file @
139cb718
...
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
...
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
import
glob
import
glob
import
os
import
os
version
=
'0.
6
-dev'
version
=
'0.
8
-dev'
name
=
'slapos.cookbook'
name
=
'slapos.cookbook'
long_description
=
open
(
"README.txt"
).
read
()
+
"
\
n
"
+
\
long_description
=
open
(
"README.txt"
).
read
()
+
"
\
n
"
+
\
open
(
"CHANGES.txt"
).
read
()
+
"
\
n
"
open
(
"CHANGES.txt"
).
read
()
+
"
\
n
"
...
...
slapos/recipe/erp5testnode/SlapOSControler.py
View file @
139cb718
...
@@ -46,18 +46,12 @@ class SlapOSControler(object):
...
@@ -46,18 +46,12 @@ 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'
]
stdout
=
open
(
os
.
path
.
join
(
config
[
'instance_root'
],
'.runSoftwareRelease_out'
),
'w+'
)
stderr
=
open
(
os
.
path
.
join
(
config
[
'instance_root'
],
'.runSoftwareRelease_err'
),
'w+'
)
slapgrid
=
subprocess
.
Popen
([
config
[
'slapgrid_software_binary'
],
'-v'
,
'-c'
,
slapgrid
=
subprocess
.
Popen
([
config
[
'slapgrid_software_binary'
],
'-v'
,
'-c'
,
#'--buildout-parameter',"'-U -N' -o",
#'--buildout-parameter',"'-U -N' -o",
config
[
'slapos_config'
]],
config
[
'slapos_config'
]],
...
@@ -75,16 +69,26 @@ class SlapOSControler(object):
...
@@ -75,16 +69,26 @@ class SlapOSControler(object):
stderr
.
close
()
stderr
.
close
()
return
status_dict
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 @
139cb718
...
@@ -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
)
slapos_method
=
getattr
(
slapos_controler
,
method_name
)
status_dict
=
slapos_method
(
config
,
environment
=
config
[
'environment'
],
environment
=
config
[
'environment'
],
process_group_pid_set
=
process_group_pid_set
,
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'
,
...
@@ -250,4 +243,3 @@ branch = %(branch)s
...
@@ -250,4 +243,3 @@ branch = %(branch)s
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