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,
'netaddr', # to manipulate on IP addresses
'setuptools', # namespaces
'inotifyx', # to watch filesystem changes (used in lockfile)
'lock_file', #another lockfile implementation for multiprocess
'slapos.core', # uses internally
# 'slapos.toolbox', # needed for libcloud, cloudmgr, disabled for now
'xml_marshaller', # need to communication with slapgrid
......
......@@ -305,6 +305,10 @@ class App(GenericBaseRecipe):
application = os.path.join(apps_dir, self.appname, self.version, platform)
wrapperdir = self.options['wrapper-dir'].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,
appname=self.appname, binary_name=bin_name,
......@@ -317,9 +321,10 @@ class App(GenericBaseRecipe):
t_input=self.options['input-file'].strip(),
binary=self.options['binary'].strip(),
bash=bash, home_dir=home,
lockfile=lockfile,
)
deploy_app = self.createPythonScript(
os.path.join(wrapperdir, 'boinc_app'),
os.path.join(wrapperdir, 'boinc_%s' % self.appname),
'%s.configure.deployApp' % __name__, parameter
)
path_list.append(deploy_app)
......
......@@ -33,6 +33,8 @@ import shutil
import re
import filecmp
from lock_file import LockFile
def checkMysql(args):
sys.path += args['environment']['PYTHONPATH'].split(':')
import MySQLdb
......@@ -170,8 +172,15 @@ def services(args):
writeFile(args['service_status'], "started")
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"""
if not check_installRequest(args):
return
......
[buildout]
# Local development
develop =
${:parts-directory}/slapos.cookbook-repository
......
......@@ -34,7 +34,7 @@ eggs =
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-boinc.cfg
output = ${buildout:directory}/template-boinc.cfg
md5sum = aec96557358303b5c5c05988a08bb86f
md5sum = 22de71bad135ab3c760c63e537dcb182
mode = 0644
#Template for deploying MySQL Database Server
......
......@@ -309,8 +309,6 @@ config = url custom_domain
config-url = http://[$${apache-php:ip}]:$${apache-php:port}/
return = site_url
config-custom_domain = $${slap-parameter:domain}
sla = instance_guid
sla-instance_guid = $${slap-parameter:instance_guid}
# Deploy slapmonitor
......@@ -387,7 +385,6 @@ wu-number =
input-file =
# Default value if no domain is specified
domain =
instance_guid = SOFTINST-3
# Default value if no ssh parameter is specified
logbox-ip =
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