[LNT] r349220 - Make sure hooks are not run before they are loaded
Chris Matthews via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 14 16:34:04 PST 2018
Author: cmatthews
Date: Fri Dec 14 16:34:04 2018
New Revision: 349220
URL: http://llvm.org/viewvc/llvm-project?rev=349220&view=rev
Log:
Make sure hooks are not run before they are loaded
This is certainly a programming error of some sort.
Modified:
lnt/trunk/lnt/server/db/rules_manager.py
Modified: lnt/trunk/lnt/server/db/rules_manager.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/db/rules_manager.py?rev=349220&r1=349219&r2=349220&view=diff
==============================================================================
--- lnt/trunk/lnt/server/db/rules_manager.py (original)
+++ lnt/trunk/lnt/server/db/rules_manager.py Fri Dec 14 16:34:04 2018
@@ -4,7 +4,6 @@ Define facilities for automatically appl
import os
import re
from lnt.util import logger
-from lnt.testing.util.commands import timed
def load_rules():
@@ -53,12 +52,14 @@ HOOKS = {
'is_useful_change': [],
}
DESCRIPTIONS = {}
+HOOKS_LOADED = False
def register_hooks():
"""Exec all the rules files. Gather the hooks from them
and load them into the hook dict for later use.
"""
+ global HOOKS_LOADED
for name, path in load_rules().items():
globals = {}
execfile(path, globals)
@@ -66,11 +67,14 @@ def register_hooks():
for hook_name in HOOKS.keys():
if hook_name in globals:
HOOKS[hook_name].append(globals[hook_name])
+ HOOKS_LOADED = True
return HOOKS
def post_submission_hooks(session, ts, run_id):
"""Run all the post submission hooks on the submitted run."""
+ if not HOOKS_LOADED:
+ logger.error("Running Hooks without loading them first.")
for func in HOOKS['post_submission_hook']:
func(session, ts, run_id)
More information about the llvm-commits
mailing list