Commit a0bc26e9 authored by Nicolas Wavrant's avatar Nicolas Wavrant

runner: infos on slapgrid are stored in a file when it finishes.

Also, return code of Popened-processes are now always read when they finish
parent ad5feea0
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
# pylint: disable-msg=W0311,C0301,C0103,C0111,W0141,W0142 # pylint: disable-msg=W0311,C0301,C0103,C0111,W0141,W0142
import ConfigParser import ConfigParser
import datetime
import json import json
import logging import logging
import md5 import md5
...@@ -275,6 +276,19 @@ def isSoftwareRunning(config=None): ...@@ -275,6 +276,19 @@ def isSoftwareRunning(config=None):
return isRunning('slapgrid-sr') return isRunning('slapgrid-sr')
def slapgridResultToFile(config, step, returncode, datetime):
filename = step + "_info.json"
file = os.path.join(config['runner_workdir'], filename)
result = {'last_build':datetime, 'success':returncode}
open(file, "w").write(json.dumps(result))
def waitProcess(config, process, step):
process.wait()
date = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
slapgridResultToFile(config, step, process.returncode, date)
def runSoftwareWithLock(config, lock=True): def runSoftwareWithLock(config, lock=True):
""" """
Use Slapgrid to compile current Software Release and wait until Use Slapgrid to compile current Software Release and wait until
...@@ -301,10 +315,13 @@ def runSoftwareWithLock(config, lock=True): ...@@ -301,10 +315,13 @@ def runSoftwareWithLock(config, lock=True):
name='slapgrid-sr', stdout=None) name='slapgrid-sr', stdout=None)
if lock: if lock:
slapgrid.wait() slapgrid.wait()
date = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
slapgridResultToFile(config, "software", slapgrid.returncode, date)
#Saves the current compile software for re-use #Saves the current compile software for re-use
config_SR_folder(config) config_SR_folder(config)
return ( True if slapgrid.returncode == 0 else False ) return ( True if slapgrid.returncode == 0 else False )
else: else:
thread.start_new_thread(waitProcess, (config, slapgrid, "software"))
return False return False
...@@ -401,8 +418,11 @@ def runInstanceWithLock(config, lock=True): ...@@ -401,8 +418,11 @@ def runInstanceWithLock(config, lock=True):
name='slapgrid-cp', stdout=None) name='slapgrid-cp', stdout=None)
if lock: if lock:
slapgrid.wait() slapgrid.wait()
date = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
slapgridResultToFile(config, "instance", slapgrid.returncode, date)
return ( True if slapgrid.returncode == 0 else False ) return ( True if slapgrid.returncode == 0 else False )
else: else:
thread.start_new_thread(waitProcess, (config, slapgrid, "instance"))
return False return False
......
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