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
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
Aurel
slapos
Commits
b9a5e418
Commit
b9a5e418
authored
Oct 10, 2012
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update boinc-client and allow to run multiple client on the same physical computer
parent
b1b87312
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
157 additions
and
142 deletions
+157
-142
component/boinc-client/buildout.cfg
component/boinc-client/buildout.cfg
+1
-3
slapos/recipe/boinc/__init__.py
slapos/recipe/boinc/__init__.py
+38
-9
slapos/recipe/boinc/configure.py
slapos/recipe/boinc/configure.py
+41
-36
software/boinc-client/instance-boinc.cfg
software/boinc-client/instance-boinc.cfg
+58
-0
software/boinc-client/instance.cfg
software/boinc-client/instance.cfg
+5
-33
software/boinc-client/software.cfg
software/boinc-client/software.cfg
+14
-61
No files found.
component/boinc-client/buildout.cfg
View file @
b9a5e418
...
...
@@ -12,7 +12,6 @@ extends =
../automake/buildout.cfg
../libtool/buildout.cfg
../pkgconfig/buildout.cfg
../cyrus-sasl/buildout.cfg
../openldap/buildout.cfg
../gnutls/buildout.cfg
../../stack/slapos.cfg
...
...
@@ -39,7 +38,7 @@ location = ${buildout:parts-directory}/BOINC
[boinc-patch]
recipe = slapos.recipe.download
url = ${:_profile_base_location_}/boinc-abs-path.patch
md5sum = 4
f385abae9da5ebea7a73d316ebda31
8
md5sum = 4
12acedfbcdc8a9a7f196a02465da24
8
location = ${buildout:parts-directory}/${:_buildout_section_name_}
filename = boinc-abs-path.patch
...
...
@@ -73,7 +72,6 @@ configure-options =
--disable-server
--with-pkg-config
--with-ssl=${openssl:location}
--with-libsasl2=${cyrus-sasl:location}/lib
--with-libldap=${openldap:location}/lib
--with-libgnutls=${gnutls:location}/lib
--with-libcurl=${curl:location}/lib
...
...
slapos/recipe/boinc/__init__.py
View file @
b9a5e418
...
...
@@ -238,7 +238,8 @@ class App(GenericBaseRecipe):
sh_script
=
self
.
createFile
(
bash
,
self
.
substituteTemplate
(
self
.
getTemplateFilename
(
'sed_update.in'
),
dict
(
dash
=
self
.
options
[
'dash'
].
strip
(),
uldl_pid
=
self
.
options
[
'apache-pid'
].
strip
()))
uldl_pid
=
self
.
options
[
'apache-pid'
].
strip
(),
user
=
self
.
options
[
'user'
]))
)
path_list
.
append
(
sh_script
)
os
.
chmod
(
bash
,
0700
)
...
...
@@ -280,21 +281,49 @@ class App(GenericBaseRecipe):
class
Client
(
GenericBaseRecipe
):
"""Deploy a fully fonctionnal boinc client connected to a boinc server instance"""
def
__init__
(
self
,
buildout
,
name
,
options
):
#get current uig to create a unique rpc-port for this client
stat_info
=
os
.
stat
(
options
[
'install-dir'
].
strip
())
options
[
'rpc-port'
]
=
pwd
.
getpwuid
(
stat_info
.
st_uid
)[
2
]
+
5000
return
GenericBaseRecipe
.
__init__
(
self
,
buildout
,
name
,
options
)
def
install
(
self
):
path_list
=
[]
boincbin
=
self
.
options
[
'boinc-bin'
].
strip
()
cmdbin
=
self
.
options
[
'cmd-bin'
].
strip
()
installdir
=
self
.
options
[
'install-dir'
].
strip
()
url
=
self
.
options
[
'server-url'
].
strip
()
key
=
self
.
options
[
'key'
].
strip
()
boinc_wrapper
=
self
.
options
[
'client-wrapper'
].
strip
()
cmd_wrapper
=
self
.
options
[
'cmd-wrapper'
].
strip
()
remote_host
=
os
.
path
.
join
(
installdir
,
'remote_hosts.cfg'
)
open
(
remote_host
,
'w'
).
write
(
self
.
options
[
'ip'
].
strip
())
#Generate wrapper for boinc_client
client_wrapper
=
self
.
createPythonScript
(
boinc_wrapper
,
'slapos.recipe.librecipe.execute.execute'
,
([
boincbin
,
'--dir'
,
installdir
,
'--attach_project'
,
url
,
key
])
#Generate wrapper for boinc cmd
base_cmd
=
[
cmdbin
,
'--host'
,
str
(
self
.
options
[
'rpc-port'
]),
'--passwd'
,
self
.
options
[
'passwd'
].
strip
()]
cc_cmd
=
''
if
self
.
options
[
'cconfig'
].
strip
()
!=
''
:
config_dest
=
os
.
path
.
join
(
installdir
,
'cc_config.xml'
)
file
=
open
(
config_dest
,
'w'
)
file
.
write
(
open
(
self
.
options
[
'cconfig'
].
strip
(),
'r'
).
read
())
file
.
close
()
cc_cmd
=
'--read_cc_config'
cmd
=
self
.
createPythonScript
(
cmd_wrapper
,
'%s.configure.runCmd'
%
__name__
,
dict
(
base_cmd
=
base_cmd
,
cc_cmd
=
cc_cmd
,
installdir
=
installdir
,
project_url
=
url
,
key
=
key
)
)
path_list
.
append
(
client_wrapper
)
return
path_list
path_list
.
append
(
cmd
)
update
=
install
\ No newline at end of file
#Generate BOINC client wrapper
boinc
=
self
.
createPythonScript
(
boinc_wrapper
,
'slapos.recipe.librecipe.execute.execute'
,
[
boincbin
,
'--allow_multiple_clients'
,
'--gui_rpc_port'
,
str
(
self
.
options
[
'rpc-port'
]),
'--allow_remote_gui_rpc'
,
'--dir'
,
installdir
,
'--redirectio'
,
'--check_all_logins'
]
)
path_list
.
append
(
boinc
)
return
path_list
slapos/recipe/boinc/configure.py
View file @
b9a5e418
...
...
@@ -30,6 +30,7 @@ import sys
import
subprocess
import
time
import
shutil
import
re
def
checkMysql
(
args
):
sys
.
path
+=
args
[
'python_path'
].
split
(
':'
)
...
...
@@ -45,15 +46,22 @@ def checkMysql(args):
conn
.
close
()
print
"Successfully connect to MySQL database... "
if
args
.
has_key
(
'file_status'
):
file
=
open
(
args
[
'file_status'
],
'w'
)
file
.
write
(
"starting"
)
file
.
close
()
writeFile
(
args
[
'file_status'
],
"starting"
)
break
except
Exception
,
ex
:
print
"The result is:
\
n
"
+
ex
.
message
print
"Could not connect to MySQL database... sleep for 2 secondes"
time
.
sleep
(
2
)
def
checkFile
(
file
,
stime
):
"""Loop until 'file' is created (exist)"""
while
True
:
print
"Search for file %s..."
%
file
if
not
os
.
path
.
exists
(
file
):
print
"File not found... sleep for %s secondes"
%
stime
time
.
sleep
(
stime
)
else
:
break
def
services
(
args
):
"""This function configure a new installed boinc project instance"""
...
...
@@ -62,13 +70,7 @@ def services(args):
print
"Not need to install Boinc-server...skipped"
return
#Sleep until file 'boinc_project'.readme exist
while
True
:
print
"Search for file %s..."
%
args
[
'readme'
]
if
not
os
.
path
.
exists
(
args
[
'readme'
]):
print
"File not found... sleep for 3 secondes"
time
.
sleep
(
3
)
else
:
break
checkFile
(
args
[
'readme'
],
3
)
topath
=
os
.
path
.
join
(
args
[
'installroot'
],
'html/ops/.htpasswd'
)
print
"Generating .htpasswd file... File=%s"
%
topath
...
...
@@ -111,20 +113,12 @@ def services(args):
if
not
startProcess
([
"php"
,
forum_file
],
env
,
cwd
):
return
status
=
open
(
args
[
'service_status'
],
"w"
)
status
.
write
(
"started"
)
status
.
close
()
writeFile
(
args
[
'service_status'
],
"started"
)
def
restart_boinc
(
args
):
"""Stop (if currently is running state) and start all Boinc service"""
if
args
[
'drop_install'
]:
while
True
:
print
"Search for file %s..."
%
args
[
'service_status'
]
if
not
os
.
path
.
exists
(
args
[
'service_status'
]):
print
"File not found... sleep for 3 secondes"
time
.
sleep
(
3
)
else
:
break
checkFile
(
args
[
'service_status'
],
3
)
else
:
checkMysql
(
args
)
print
"Restart Boinc..."
...
...
@@ -133,9 +127,7 @@ def restart_boinc(args):
binstop
=
os
.
path
.
join
(
args
[
'installroot'
],
'bin/stop'
)
os
.
system
(
binstop
)
os
.
system
(
binstart
)
status
=
open
(
args
[
'start_boinc'
],
"w"
)
status
.
write
(
"started"
)
status
.
close
()
writeFile
(
args
[
'start_boinc'
],
"started"
)
print
"Done."
def
deployApp
(
args
):
...
...
@@ -155,13 +147,7 @@ def deployApp(args):
args
[
'previous_wu'
]
=
0
dropapp
=
True
#Sleep until file .start_boinc exist (File indicate that BOINC has been started)
while
True
:
print
"Search for file %s..."
%
args
[
'start_boinc'
]
if
not
os
.
path
.
exists
(
args
[
'start_boinc'
]):
print
"File not found... sleep for 3 secondes"
time
.
sleep
(
3
)
else
:
break
checkFile
(
args
[
'start_boinc'
],
3
)
print
"setup directories..."
args
[
'inputfile'
]
=
os
.
path
.
join
(
args
[
'installroot'
],
'download'
,
...
...
@@ -243,9 +229,7 @@ def deployApp(args):
os
.
system
(
binstart
)
print
"Boinc Application deployment is done... writing end signal file..."
sfile
=
open
(
token
,
'w'
)
sfile
.
write
(
str
(
args
[
'wu_number'
]))
sfile
.
close
()
writeFile
(
token
,
str
(
args
[
'wu_number'
]))
def
create_wu
(
args
,
env
):
t_result
=
"templates/"
+
args
[
'appname'
]
+
'_result'
...
...
@@ -253,14 +237,15 @@ def create_wu(args, env):
launch_args
=
[
os
.
path
.
join
(
args
[
'installroot'
],
'bin/create_work'
),
'--appname'
,
args
[
'appname'
],
'--wu_name'
,
''
,
'--wu_template'
,
t_wu
,
'--result_template'
,
t_result
,
'--min_quorum'
,
'1'
,
'--target_nresults'
,
'1'
,
args
[
'appname'
]
+
'_input'
]
for
i
in
range
(
args
[
'previous_wu'
],
args
[
'wu_number'
]):
print
"Creating project wroker %s..."
%
str
(
i
+
1
)
launch_args
[
4
]
=
args
[
'appname'
]
+
str
(
i
+
1
)
+
args
[
'version'
]
+
'_nodelete'
startProcess
(
launch_args
,
env
,
args
[
'installroot'
])
def
startProcess
(
launch_args
,
env
=
None
,
cwd
=
None
):
process
=
subprocess
.
Popen
(
launch_args
,
stdout
=
s
ubprocess
.
PIPE
,
def
startProcess
(
launch_args
,
env
=
None
,
cwd
=
None
,
stdout
=
subprocess
.
PIPE
):
process
=
subprocess
.
Popen
(
launch_args
,
stdout
=
s
tdout
,
stderr
=
subprocess
.
STDOUT
,
env
=
env
,
cwd
=
cwd
)
result
=
process
.
communicate
()[
0
]
...
...
@@ -269,4 +254,24 @@ def startProcess(launch_args, env=None, cwd=None):
return
False
return
True
\ No newline at end of file
def
runCmd
(
args
):
"""Wait for Boinc Client started and run boinc cmd"""
client_config
=
os
.
path
.
join
(
args
[
'installdir'
],
'client_state.xml'
)
checkFile
(
client_config
,
5
)
time
.
sleep
(
10
)
#Scan client state xml to find client ipv4 adress
host
=
result
=
re
.
search
(
"<ip_addr>([
\
w
\
d
\
.:]+)</ip_
a
ddr>"
,
open
(
client_config
,
'r'
).
read
()).
group
(
1
)
args
[
'base_cmd'
][
2
]
=
host
+
':'
+
args
[
'base_cmd'
][
2
]
print
"Run boinccmd with host at %s "
%
args
[
'base_cmd'
][
2
]
project_args
=
args
[
'base_cmd'
]
+
[
'--project_attach'
,
args
[
'project_url'
],
args
[
'key'
]]
startProcess
(
project_args
,
cwd
=
args
[
'installdir'
])
if
args
[
'cc_cmd'
]
!=
''
:
#Load or reload cc_config file
startProcess
(
args
[
'base_cmd'
]
+
[
args
[
'cc_cmd'
]],
cwd
=
args
[
'installdir'
])
def
writeFile
(
file
,
content
):
f
=
open
(
file
,
'w'
)
f
.
write
(
content
)
f
.
close
()
\ No newline at end of file
software/boinc-client/instance-boinc.cfg
0 → 100644
View file @
b9a5e418
[buildout]
parts =
boinc-client
publish-connection-informations
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true
[rootdirectory]
recipe = slapos.cookbook:mkdirectory
etc = $${buildout:directory}/etc/
var = $${buildout:directory}/var/
srv = $${buildout:directory}/srv/
bin = $${buildout:directory}/bin/
tmp = $${buildout:directory}/tmp/
[basedirectory]
recipe = slapos.cookbook:mkdirectory
log = $${rootdirectory:var}/log/
services = $${rootdirectory:etc}/run/
run = $${rootdirectory:var}/run/
backup = $${rootdirectory:srv}/backup/
promises = $${rootdirectory:etc}/promise/
boinc = $${rootdirectory:srv}/boinc/
[boinc-passwd]
recipe = slapos.cookbook:generate.password
storage-path = $${basedirectory:boinc}/gui_rpc_auth.cfg
bytes = 8
[boinc-client]
recipe = slapos.cookbook:boinc.client
install-dir = $${basedirectory:boinc}
client-wrapper = $${basedirectory:services}/boinc_client
cmd-wrapper = $${basedirectory:services}/boinc_cmd
#specifie a cc_config.xml file to boinc client, use cconfig
ip = $${slap-network-information:global-ipv6}
passwd = $${boinc-passwd:passwd}
cconfig =
boinc-bin = ${boinc:location}/bin/boinc_client
cmd-bin = ${boinc:location}/bin/boinccmd
server-url = $${slap-parameter:project_url}
key = $${slap-parameter:key}
# Publish all instance parameters
[publish-connection-informations]
recipe = slapos.cookbook:publish
project-url = $${slap-parameter:project_url}
account-key = $${slap-parameter:key}
remote-host = $${boinc-client:ip}
rpc-port = $${boinc-client:rpc-port}
rpc-passwd = $${boinc-passwd:passwd}
[slap-parameter]
#please provide project_url and your session key via SlapOS Master (instance parameters)
project_url =
key =
software/boinc-client/instance.cfg
View file @
b9a5e418
[buildout]
parts =
instanc
e
switch_softwaretyp
e
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true
[rootdirectory]
recipe = slapos.cookbook:mkdirectory
etc = $${buildout:directory}/etc/
var = $${buildout:directory}/var/
srv = $${buildout:directory}/srv/
bin = $${buildout:directory}/bin/
tmp = $${buildout:directory}/tmp/
[basedirectory]
recipe = slapos.cookbook:mkdirectory
log = $${rootdirectory:var}/log/
services = $${rootdirectory:etc}/run/
run = $${rootdirectory:var}/run/
backup = $${rootdirectory:srv}/backup/
promises = $${rootdirectory:etc}/promise/
boinc = $${rootdirectory:srv}/boinc/
[instance]
recipe = slapos.cookbook:boinc.client
install-dir = $${basedirectory:boinc}
client-wrapper = $${basedirectory:services}/boinc_client
#specifie a cc_config.xml file to boinc client, use cconfig
cconfig =
boinc-bin = ${boinc:location}/bin/boinc_client
server-url = $${slap-parameter:project_url}
key = $${slap-parameter:key}
[slap-parameter]
#please provide project_url and your session key via SlapOS Master (instance parameters)
project_url = http://[2001:470:1f14:169:f070:3202:6eee:903f]:8080/boinc_test/
key = 1_16e214b9bd0735f9aaef03ee413b8711
[switch_softwaretype]
recipe = slapos.cookbook:softwaretype
default = ${template-boinc:output}
\ No newline at end of file
software/boinc-client/software.cfg
View file @
b9a5e418
[buildout]
develop =
/srv/slapgrid/slappart19/srv//runner/project/slapos.github
parts=
slapos-cookbook
boinc
template
template-boinc
extends =
../../component/boinc-client/buildout.cfg
...
...
@@ -13,68 +17,17 @@ extends =
# Default template for boinc-client instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
md5sum =
e0b6e4ea739bbc4bf59a9009b7b0aa80
md5sum =
79f4d781c1b385d2afa75ae4077c5381
output = ${buildout:directory}/template.cfg
mode = 0644
[versions]
Jinja2 = 2.6
Werkzeug = 0.8.3
buildout-versions = 1.7
hexagonit.recipe.cmmi = 1.6
lxml = 3.0alpha2
meld3 = 0.6.8
plone.recipe.command = 1.1
slapos.recipe.download = 1.0.dev-r4053
slapos.recipe.template = 2.4.2
# Required by:
# slapos.core==0.28.6
Flask = 0.9
# Required by:
# slapos.cookbook==0.60-dev
PyXML = 0.8.4
# Required by:
# hexagonit.recipe.cmmi==1.6
hexagonit.recipe.download = 1.5.1
# Required by:
# slapos.cookbook==0.60-dev
inotifyx = 0.2.0
# Required by:
# slapos.cookbook==0.60-dev
netaddr = 0.7.10
# Required by:
# slapos.core==0.28.6
netifaces = 0.8
# Required by:
# slapos.cookbook==0.60-dev
# slapos.core==0.28.6
# zc.buildout==1.6.0-dev-SlapOS-006
# zc.recipe.egg==1.3.2
setuptools = 0.6c12dev-r88846
# Required by:
# slapos.cookbook==0.60-dev
slapos.core = 0.28.6
# Required by:
# slapos.core==0.28.6
supervisor = 3.0a12
# Required by:
# slapos.cookbook==0.60-dev
xml-marshaller = 0.9.7
# Required by:
# slapos.cookbook==0.60-dev
zc.recipe.egg = 1.3.2
[template-boinc]
# Default template for boinc-client instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-boinc.cfg
md5sum = 147fd101d507c4f8eba9694e25571d4e
output = ${buildout:directory}/template-boinc.cfg
mode = 0644
# Required by:
# slapos.core==0.28.6
zope.interface = 4.0.1
[versions]
lxml = 2.3.6
\ 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