Process log files for failed/success results

This commit is contained in:
Joshua Hesketh 2013-08-12 17:15:04 +10:00
parent 070a0c2e14
commit ded9d9f6a7
4 changed files with 12 additions and 15 deletions

View File

@ -202,7 +202,8 @@ def local_push_file(job_unique_number, file_path, local_config):
dest_file = os.path.join(dest_dir, dest_filename) dest_file = os.path.join(dest_dir, dest_filename)
shutil.copyfile(file_path, dest_file) shutil.copyfile(file_path, dest_file)
return local_config['prepend_url'] + dest_filename return local_config['prepend_url'] + os.path.join(job_unique_number,
dest_filename)
def scp_push_file(job_unique_number, file_path, local_config): def scp_push_file(job_unique_number, file_path, local_config):

View File

@ -71,22 +71,22 @@ def generate_push_results(datasets, job_unique_number, publish_config):
def check_log_for_errors(logfile): def check_log_for_errors(logfile):
""" Run regex over the given logfile to find errors """ """ Run regex over the given logfile to find errors """
MIGRATION_START_RE = re.compile('([0-9]+) -> ([0-9]+)\.\.\.$') MIGRATION_START_RE = re.compile('([0-9]+) -\> ([0-9]+)\.\.\. $')
MIGRATION_END_RE = re.compile('^done$') MIGRATION_END_RE = re.compile('done$')
MIGRATION_COMMAND_START = '***** Start DB upgrade to state of' #MIGRATION_COMMAND_START = '***** Start DB upgrade to state of'
MIGRATION_COMMAND_END = '***** Finished DB upgrade to state of' #MIGRATION_COMMAND_END = '***** Finished DB upgrade to state of'
with open(logfile,'r') as fd: with open(logfile, 'r') as fd:
migration_started = False migration_started = False
for line in fd: for line in fd:
if MIGRATION_START_RE.match(line): if MIGRATION_START_RE.search(line):
if migration_started: if migration_started:
# We didn't see the last one finish, # We didn't see the last one finish,
# something must have failed # something must have failed
return False return False
migration_started = True migration_started = True
elif MIGRATION_END_RE.match(line): elif MIGRATION_END_RE.search(line):
if migration_started: if migration_started:
# We found the end to this migration # We found the end to this migration
migration_started = False migration_started = False

View File

@ -57,16 +57,16 @@ EOF
nova_manage="$3/bin/nova-manage" nova_manage="$3/bin/nova-manage"
if [ -e $nova_manage ] if [ -e $nova_manage ]
then then
echo "***** DB upgrade to state of $1 starts *****" echo "***** Start DB upgrade to state of $1 *****"
python $nova_manage --config-file $2/nova-$1.conf db sync python $nova_manage --config-file $2/nova-$1.conf db sync
else else
python setup.py -q clean python setup.py -q clean
python setup.py -q develop python setup.py -q develop
python setup.py -q install python setup.py -q install
echo "***** DB upgrade to state of $1 starts *****" echo "***** Start DB upgrade to state of $1 *****"
nova-manage --config-file $2/nova-$1.conf db sync nova-manage --config-file $2/nova-$1.conf db sync
fi fi
echo "***** DB upgrade to state of $1 finished *****" echo "***** Finished DB upgrade to state of $1 *****"
set +x set +x
} }
@ -136,5 +136,3 @@ git branch -D working
echo "Cleaning up virtual env" echo "Cleaning up virtual env"
deactivate deactivate
rmvirtualenv $1 rmvirtualenv $1
echo "done"

View File

@ -93,7 +93,6 @@ class Runner(threading.Thread):
self.cancelled = False self.cancelled = False
self.job = self.gearman_worker.getJob() self.job = self.gearman_worker.getJob()
self._handle_job() self._handle_job()
return
except: except:
self.log.exception('Exception retrieving log event.') self.log.exception('Exception retrieving log event.')
@ -159,7 +158,6 @@ class Runner(threading.Thread):
self.datasets[i]['result'] = 'SUCCESS' if result else 'FAILURE' self.datasets[i]['result'] = 'SUCCESS' if result else 'FAILURE'
if not result: if not result:
failed = True failed = True
break
if failed: if failed:
self.work_data['result'] = "Failed: errors found in dataset log(s)" self.work_data['result'] = "Failed: errors found in dataset log(s)"