6 Common variables and functions used in Trigger ART test steering 
   12 from functools 
import lru_cache
 
   16 trigvalsteering_logging_level = logging.INFO
 
   19 package_prefix_dict = {
'TriggerTest':         
'trig_',
 
   20                        'TrigP1Test':          
'trigP1_',
 
   21                        'TrigAnalysisTest':    
'trigAna_',
 
   22                        'TrigInDetValidation': 
'trigID_',
 
   23                        'TrigGpuTest':         
'trigGPU_',}
 
   26 art_result_summary = 
'art-result-summary.log' 
   29 art_input_eos = 
'/eos/atlas/atlascerngroupdisk/data-art/grid-input/' 
   30 art_input_cvmfs = 
'/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/' 
   34     '''Default TrigValSteering logger''' 
   35     logging.basicConfig(stream=sys.stdout,
 
   36                         format=
'%(asctime)s %(name)s %(levelname)-8s %(message)s',
 
   37                         datefmt=
'%Y-%m-%dT%H%M%S %Z',
 
   38                         level=trigvalsteering_logging_level)
 
   39     return logging.getLogger(
'TrigValSteering')
 
   43     '''Print art-result to stdout and summary log file''' 
   45     line = 
'art-result: {} {}\n'.
format(result, name)
 
   46     sys.stdout.write(line)
 
   47     with open(art_result_summary, 
'a') 
as summary:
 
   52     '''Remove art-result summary file produced by the art_result function''' 
   54     if os.path.isfile(art_result_summary):
 
   55         os.remove(art_result_summary)
 
   60     Bash inline command frequently used in multi-step tests 
   61     to pass the output of one step to the input of another 
   62     based on a name pattern rather than a fixed full file name 
   64     return '`find . -name \'{:s}\' | tail -n 1`'.
format(pattern)
 
   67     '''Find filename in search path given by environment variable''' 
   70     for path 
in os.environ[path_env_var].
split(os.pathsep):
 
   71         f = os.path.join( path, filename )
 
   72         if os.access(f, os.R_OK):
 
   79     return os.environ.get(
'gitlabTargetBranch') 
is not None