Skip to content
Snippets Groups Projects
Commit 02a8bdd9 authored by Tadej Novak's avatar Tadej Novak
Browse files

Merge branch 'GenWarningPatches' into 'main'

Moving to use evgen keywords helper functions in transforms

See merge request atlas/athena!75296
parents ea80a36d 1b99432d
No related branches found
No related tags found
No related merge requests found
......@@ -327,35 +327,8 @@ else:
## Check that the keywords are in the list of allowed words (and exit if processing an official JO)
if evgenConfig.keywords:
## Get the allowed keywords file from the JO package if possibe
# TODO: Make the package name configurable
kwfile = "EvgenJobTransforms/evgenkeywords.txt"
kwpath = None
for p in os.environ["JOBOPTSEARCHPATH"].split(":"):
kwpath = os.path.join(p, kwfile)
if os.path.exists(kwpath):
break
kwpath = None
## Load the allowed keywords from the file
allowed_keywords = []
if kwpath:
evgenLog.info("evgenkeywords = " + kwpath)
kwf = open(kwpath, "r")
for l in kwf:
allowed_keywords += l.strip().lower().split()
## Check the JO keywords against the allowed ones
evil_keywords = []
for k in evgenConfig.keywords:
if k not in allowed_keywords:
evil_keywords.append(k)
if evil_keywords:
msg = "evgenConfig.keywords contains non-standard keywords: %s. " % ", ".join(evil_keywords)
msg += "Please check the allowed keywords list and fix."
evgenLog.error(msg)
if officialJO:
sys.exit(1)
else:
evgenLog.warning("evgenkeywords = not found ")
from GeneratorConfig.GenConfigHelpers import checkKeywords
checkKeywords(evgenConfig, evgenLog, officialJO)
## Configure and schedule jet finding algorithms
## NOTE: This generates algorithms for jet containers defined in the user's JO fragment
......
......@@ -369,35 +369,8 @@ else:
## Check that the keywords are in the list of allowed words (and exit if processing an official JO)
if evgenConfig.keywords:
## Get the allowed keywords file from the JO package if possibe
# TODO: Make the package name configurable
kwfile = "evgenkeywords.txt"
kwpath = None
for p in os.environ["DATAPATH"].split(":"):
kwpath = os.path.join(p, kwfile)
if os.path.exists(kwpath):
break
kwpath = None
## Load the allowed keywords from the file
allowed_keywords = []
if kwpath:
evgenLog.info("evgenkeywords = "+kwpath)
kwf = open(kwpath, "r")
for l in kwf:
allowed_keywords += l.strip().lower().split()
## Check the JO keywords against the allowed ones
evil_keywords = []
for k in evgenConfig.keywords:
if k.lower() not in allowed_keywords:
evil_keywords.append(k)
if evil_keywords:
msg = "evgenConfig.keywords contains non-standard keywords: %s. " % ", ".join(evil_keywords)
msg += "Please check the allowed keywords list and fix."
evgenLog.error(msg)
if officialJO:
sys.exit(1)
else:
evgenLog.warning("evgenkeywords = not found ")
from GeneratorConfig.GenConfigHelpers import checkKeywords
checkKeywords(evgenConfig, evgenLog, officialJO)
## Check that the L1 and L2 keywords pairs are in the list of allowed words pairs (and exit if processing an official JO)
if evgenConfig.categories:
......
......@@ -288,35 +288,8 @@ if not evgenConfig.keywords:
## Check that the keywords are in the list of allowed words (and exit if processing an official JO)
if evgenConfig.keywords:
## Get the allowed keywords file from the JO package if possibe
# TODO: Make the package name configurable
kwfile = "evgenkeywords.txt"
kwpath = None
for p in os.environ["DATAPATH"].split(":"):
kwpath = os.path.join(p, kwfile)
if os.path.exists(kwpath):
break
kwpath = None
## Load the allowed keywords from the file
allowed_keywords = []
if kwpath:
evgenLog.info("evgenkeywords = "+kwpath)
kwf = open(kwpath, "r")
for l in kwf:
allowed_keywords += l.strip().lower().split()
## Check the JO keywords against the allowed ones
evil_keywords = []
for k in evgenConfig.keywords:
if k.lower() not in allowed_keywords:
evil_keywords.append(k)
if evil_keywords:
msg = "evgenConfig.keywords contains non-standard keywords: %s. " % ", ".join(evil_keywords)
msg += "Please check the allowed keywords list and fix."
evgenLog.error(msg)
if officialJO:
sys.exit(1)
else:
evgenLog.warning("Could not find evgenkeywords.txt file %s in $JOBOPTSEARCHPATH" % kwfile)
from GeneratorConfig.GenConfigHelpers import checkKeywords
checkKeywords(evgenConfig, evgenLog, officialJO)
## Check that the categories list is not empty:
if not evgenConfig.categories:
......
......@@ -172,7 +172,7 @@ def checkKeywords(sample, evgenLog, officialJO):
import sys
sys.exit(1)
else:
evgenLog.warning("evgenkeywords = not found ")
evgenLog.warning("evgenkeywords.txt not found ")
def checkCategories(sample, evgenLog, officialJO):
# Get file containing category names
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment