Commit 332ccd39 authored by Alain Takoudjou's avatar Alain Takoudjou Committed by Cédric de Saint Martin

Synchronize mutltiple BOINC app deployment

parent b43cbcf3
...@@ -31,6 +31,7 @@ setup(name=name, ...@@ -31,6 +31,7 @@ setup(name=name,
'netaddr', # to manipulate on IP addresses 'netaddr', # to manipulate on IP addresses
'setuptools', # namespaces 'setuptools', # namespaces
'inotifyx', # to watch filesystem changes (used in lockfile) 'inotifyx', # to watch filesystem changes (used in lockfile)
'lock_file', #another lockfile implementation for multiprocess
'slapos.core', # uses internally 'slapos.core', # uses internally
# 'slapos.toolbox', # needed for libcloud, cloudmgr, disabled for now # 'slapos.toolbox', # needed for libcloud, cloudmgr, disabled for now
'xml_marshaller', # need to communication with slapgrid 'xml_marshaller', # need to communication with slapgrid
......
...@@ -305,6 +305,10 @@ class App(GenericBaseRecipe): ...@@ -305,6 +305,10 @@ class App(GenericBaseRecipe):
application = os.path.join(apps_dir, self.appname, self.version, platform) application = os.path.join(apps_dir, self.appname, self.version, platform)
wrapperdir = self.options['wrapper-dir'].strip() wrapperdir = self.options['wrapper-dir'].strip()
project = self.options['project'].strip() project = self.options['project'].strip()
lockfile = os.path.join(self.options['home'].strip(), 'app_install.lock')
fd = os.open(lockfile, os.O_RDWR|os.O_CREAT)
os.close( fd )
parameter = dict(installroot=installroot, project=project, parameter = dict(installroot=installroot, project=project,
appname=self.appname, binary_name=bin_name, appname=self.appname, binary_name=bin_name,
...@@ -317,9 +321,10 @@ class App(GenericBaseRecipe): ...@@ -317,9 +321,10 @@ class App(GenericBaseRecipe):
t_input=self.options['input-file'].strip(), t_input=self.options['input-file'].strip(),
binary=self.options['binary'].strip(), binary=self.options['binary'].strip(),
bash=bash, home_dir=home, bash=bash, home_dir=home,
lockfile=lockfile,
) )
deploy_app = self.createPythonScript( deploy_app = self.createPythonScript(
os.path.join(wrapperdir, 'boinc_app'), os.path.join(wrapperdir, 'boinc_%s' % self.appname),
'%s.configure.deployApp' % __name__, parameter '%s.configure.deployApp' % __name__, parameter
) )
path_list.append(deploy_app) path_list.append(deploy_app)
......
...@@ -33,6 +33,8 @@ import shutil ...@@ -33,6 +33,8 @@ import shutil
import re import re
import filecmp import filecmp
from lock_file import LockFile
def checkMysql(args): def checkMysql(args):
sys.path += args['environment']['PYTHONPATH'].split(':') sys.path += args['environment']['PYTHONPATH'].split(':')
import MySQLdb import MySQLdb
...@@ -170,8 +172,15 @@ def services(args): ...@@ -170,8 +172,15 @@ def services(args):
writeFile(args['service_status'], "started") writeFile(args['service_status'], "started")
def deployApp(args): def deployApp(args):
"""Deploy Boinc App with lock"""
print "Asking to enter in execution with lock mode..."
with LockFile(args['lockfile'], wait=True):
print "acquire the lock file..."
deployManagement(args)
print "Exit execution with lock..."
def deployManagement(args):
"""Fully deploy or redeploy or update a BOINC application using existing BOINC instance""" """Fully deploy or redeploy or update a BOINC application using existing BOINC instance"""
if not check_installRequest(args): if not check_installRequest(args):
return return
......
[buildout] [buildout]
# Local development # Local development
develop = develop =
${:parts-directory}/slapos.cookbook-repository ${:parts-directory}/slapos.cookbook-repository
......
...@@ -34,7 +34,7 @@ eggs = ...@@ -34,7 +34,7 @@ eggs =
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-boinc.cfg url = ${:_profile_base_location_}/instance-boinc.cfg
output = ${buildout:directory}/template-boinc.cfg output = ${buildout:directory}/template-boinc.cfg
md5sum = aec96557358303b5c5c05988a08bb86f md5sum = 22de71bad135ab3c760c63e537dcb182
mode = 0644 mode = 0644
#Template for deploying MySQL Database Server #Template for deploying MySQL Database Server
......
...@@ -309,8 +309,6 @@ config = url custom_domain ...@@ -309,8 +309,6 @@ config = url custom_domain
config-url = http://[$${apache-php:ip}]:$${apache-php:port}/ config-url = http://[$${apache-php:ip}]:$${apache-php:port}/
return = site_url return = site_url
config-custom_domain = $${slap-parameter:domain} config-custom_domain = $${slap-parameter:domain}
sla = instance_guid
sla-instance_guid = $${slap-parameter:instance_guid}
# Deploy slapmonitor # Deploy slapmonitor
...@@ -387,7 +385,6 @@ wu-number = ...@@ -387,7 +385,6 @@ wu-number =
input-file = input-file =
# Default value if no domain is specified # Default value if no domain is specified
domain = domain =
instance_guid = SOFTINST-3
# Default value if no ssh parameter is specified # Default value if no ssh parameter is specified
logbox-ip = logbox-ip =
logbox-port = logbox-port =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment