diff --git a/setup.py b/setup.py index a4fd807308bd25aeb0f699dd3801a499bacca15c..67ea4c420a91bafc725a6f801d0cb502772fbfd1 100755 --- a/setup.py +++ b/setup.py @@ -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 diff --git a/slapos/recipe/boinc/__init__.py b/slapos/recipe/boinc/__init__.py index de940e2279ce1c3edd3b0c569deee683d95802ce..b37dbb14fab8d718b8c64a530139a49d427f42d2 100644 --- a/slapos/recipe/boinc/__init__.py +++ b/slapos/recipe/boinc/__init__.py @@ -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) diff --git a/slapos/recipe/boinc/configure.py b/slapos/recipe/boinc/configure.py index daadc24af3dd9a5839c3b7ef3af29fe727a6e43d..8901be568e24ae3ad4b9bc4374b440f271e029a6 100644 --- a/slapos/recipe/boinc/configure.py +++ b/slapos/recipe/boinc/configure.py @@ -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 diff --git a/software/boinc/software.cfg b/software/boinc/software.cfg index 06926aeb82a1688fc0e64667f67b0475eb6a2463..74ce6151589ee5de8c562dcba364fdd75902db9b 100644 --- a/software/boinc/software.cfg +++ b/software/boinc/software.cfg @@ -1,4 +1,5 @@ [buildout] + # Local development develop = ${:parts-directory}/slapos.cookbook-repository diff --git a/stack/boinc/buildout.cfg b/stack/boinc/buildout.cfg index 376d399d19091cf1c621d122e16e10ee81b89ccc..72b572d93b591205296a5984dbac82dfd41bcc62 100644 --- a/stack/boinc/buildout.cfg +++ b/stack/boinc/buildout.cfg @@ -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 diff --git a/stack/boinc/instance-boinc.cfg b/stack/boinc/instance-boinc.cfg index a1a40052933b25463ac316ceef73f52b530d2110..96ffbb8c46983822be8e359b1443e60f0a31af1d 100644 --- a/stack/boinc/instance-boinc.cfg +++ b/stack/boinc/instance-boinc.cfg @@ -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 =