Commit 81ec6cab authored by Sebastien Robin's avatar Sebastien Robin

using subprocess.PIPE was a bad idea, buildout was so slow.

Use real files instead
parent ddfe3e8e
from setuptools import setup, find_packages from setuptools import setup, find_packages
name = "erp5.recipe.testnode" name = "erp5.recipe.testnode"
version = '1.0.13' version = '1.0.16'
def read(name): def read(name):
return open(name).read() return open(name).read()
......
...@@ -5,7 +5,6 @@ class SlapOSControler(object): ...@@ -5,7 +5,6 @@ class SlapOSControler(object):
def __init__(self, config, process_group_pid_list=None): def __init__(self, config, process_group_pid_list=None):
self.config = config self.config = config
self.process_group_pid_list = []
# By erasing everything, we make sure that we are able to "update" # By erasing everything, we make sure that we are able to "update"
# existing profiles. This is quite dirty way to do updates... # existing profiles. This is quite dirty way to do updates...
if os.path.exists(config['proxy_database']): if os.path.exists(config['proxy_database']):
...@@ -53,17 +52,26 @@ class SlapOSControler(object): ...@@ -53,17 +52,26 @@ class SlapOSControler(object):
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']],
stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdout=stdout, stderr=stderr,
close_fds=True, preexec_fn=os.setsid) close_fds=True, preexec_fn=os.setsid)
process_group_pid_list.append(slapgrid.pid) process_group_pid_list.append(slapgrid.pid)
slapgrid.wait() slapgrid.wait()
stdout, stderr = slapgrid.communicate() stdout.seek(0)
stderr.seek(0)
status_dict = {'status_code':slapgrid.returncode, status_dict = {'status_code':slapgrid.returncode,
'stdout':stdout, 'stdout':stdout.read(),
'stderr':stderr} 'stderr':stderr.read()}
stdout.close()
stderr.close()
return status_dict return status_dict
def runComputerPartition(self, config, process_group_pid_list=None): def runComputerPartition(self, config, process_group_pid_list=None):
......
...@@ -109,8 +109,9 @@ repository = %(repository_path)s ...@@ -109,8 +109,9 @@ repository = %(repository_path)s
updater = Updater(repository_path, git_binary=config['git_binary']) updater = Updater(repository_path, git_binary=config['git_binary'])
updater.checkout() updater.checkout()
revision = updater.getRevision() revision = updater.getRevision()
if not(retry_software) and previous_revision == revision: if previous_revision == revision:
time.sleep(120) time.sleep(120)
if not(retry_software):
continue continue
retry_software = False retry_software = False
previous_revision = revision previous_revision = revision
......
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