Commit 46ef504d authored by Sebastien Robin's avatar Sebastien Robin

move stdout and stderr file creation in testnode

This will allows to use it for several different external method
calls
parent 2561fee5
...@@ -46,18 +46,12 @@ class SlapOSControler(object): ...@@ -46,18 +46,12 @@ class SlapOSControler(object):
'reference': config['computer_id'], 'reference': config['computer_id'],
'software_root': config['software_root']})) 'software_root': config['software_root']}))
def runSoftwareRelease(self, config, environment, process_group_pid_set=None): def runSoftwareRelease(self, config, environment, process_group_pid_set=None,
stdout=None, stderr=None):
print "SlapOSControler.runSoftwareRelease" print "SlapOSControler.runSoftwareRelease"
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+')
stdout.write("SlapOSControler.runSoftwareRelease")
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']],
......
...@@ -55,6 +55,16 @@ def safeRpcCall(function, *args): ...@@ -55,6 +55,16 @@ def safeRpcCall(function, *args):
time.sleep(retry) time.sleep(retry)
retry += retry >> 1 retry += retry >> 1
def getInputOutputFileList(config, command_name)
stdout = open(os.path.join(
config['instance_root'],'.%s_out' % command_name),
'w+')
stdout.write("%s\n" command_name)
stderr = open(os.path.join(
config['instance_root'],'.%s_err' % command_name),
'w+')
return (stdout, stderr)
slapos_controler = None slapos_controler = None
def run(args): def run(args):
...@@ -171,10 +181,11 @@ branch = %(branch)s ...@@ -171,10 +181,11 @@ branch = %(branch)s
# Now prepare the installation of SlapOS # Now prepare the installation of SlapOS
slapos_controler = SlapOSControler(config, slapos_controler = SlapOSControler(config,
process_group_pid_set=process_group_pid_set) process_group_pid_set=process_group_pid_set)
# this should be always true later, but it is too slow for now stdout, stderr = getInputOutputFileList(config, "runSoftwareRelease")
status_dict = slapos_controler.runSoftwareRelease(config, status_dict = slapos_controler.runSoftwareRelease(config,
environment=config['environment'], environment=config['environment'],
process_group_pid_set=process_group_pid_set, process_group_pid_set=process_group_pid_set,
stdout=stdout, stderr=stderr
) )
if status_dict['status_code'] != 0: if status_dict['status_code'] != 0:
safeRpcCall(master.reportTaskFailure, safeRpcCall(master.reportTaskFailure,
......
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