diff options
author | Karel Kočí <cynerd@email.cz> | 2015-08-24 14:39:16 +0200 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2015-08-24 16:18:39 +0200 |
commit | a611965667c44f5db923a48d26e824d094e1a664 (patch) | |
tree | 68dada90a74f537e0008568b6dcb8f0fcc62417b /scripts/boot.py | |
parent | 9ca8696a489b5c16a2239213919c9e8b7f8c55d5 (diff) | |
download | linux-conf-perf-a611965667c44f5db923a48d26e824d094e1a664.tar.gz linux-conf-perf-a611965667c44f5db923a48d26e824d094e1a664.tar.bz2 linux-conf-perf-a611965667c44f5db923a48d26e824d094e1a664.zip |
Add boot timeout
Boot process should timeout after selected number of seconds if no
output is generated. This allows resolving some problems with possible
boot stuck.
Diffstat (limited to 'scripts/boot.py')
-rw-r--r-- | scripts/boot.py | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/scripts/boot.py b/scripts/boot.py index af39b30..31328a1 100644 --- a/scripts/boot.py +++ b/scripts/boot.py @@ -3,16 +3,28 @@ import sys import subprocess import shutil import importlib +import traceback import utils import initialize from conf import conf from conf import sf -from exceptions import MissingFile +import exceptions import database def boot(config, to_database = True): - out = utils.callsubprocess('boot', conf.boot_command, conf.boot_output, True) + try: + out = utils.callsubprocess('boot', conf.boot_command, conf.boot_output, \ + True, timeout = conf.boot_timeout) + result = 'nominal' + except exceptions.ProcessFailed as e: + result = 'failed' + out = e.output + traceback.print_exc() + except exceptions.ProcessTimeout as e: + result = 'timeout' + out = e.output + traceback.print_exc() value = None try: @@ -27,4 +39,4 @@ def boot(config, to_database = True): txt = '' for ln in out: txt += ln + '\n' - dtb.add_measure(txt, config.id, value) + dtb.add_measure(txt, result, config.id, value) |