Changeset 27440


Ignore:
Timestamp:
11/28/22 12:40:51 (2 years ago)
Author:
jdquinn
Message:

CHG: Using new test set parsing method again

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified issm/trunk-jpl/test/NightlyRun/runme.py

    r27362 r27440  
    88#
    99import argparse
    10 from glob import glob
    1110import os
    12 from re import search, split
     11import re
    1312from sys import float_info
    1413from traceback import format_exc
     
    9089    exception'; see also jenkins/jenkins.sh). These should be counted as
    9190    failures.
     91    - Figure out why the following changes allow for correct partitioning of
     92    test set, but cause an error with ADOL-C build (some test logs are parsed
     93    twice).
    9294    """
    9395
     
    116118    # }}}
    117119    #GET ids  {{{
    118     flist = glob('test*.py')  #File name must start with 'test' and must end by '.py' and must be different than 'test.py'
    119     list_ids = [int(search(r'\d+',file.split('.')[0]).group()) for file in flist if not file == 'test.py'] # Keep test id only (skip 'test' and '.py')
    120 
    121     i1, i2 = parallelrange(rank, numprocs, len(list_ids))  #Get tests for this cpu only
     120    flist = [f for f in os.listdir('.') if re.match('test[0-9]+.py', f)] # File name must follow the format "test<integer>.py"
     121    list_ids = [int(re.search(r'\d+',f.split('.')[0]).group()) for f in flist] # Retrieve test IDs
     122    i1, i2 = parallelrange(rank, numprocs, len(list_ids))  # Get tests for this CPU only
    122123    list_ids = list_ids[i1:i2 + 1]
    123124    if np.size(id) > 0 and id is not None:
     
    213214                for key in mdl.results.__dict__.keys():
    214215                    if 'Solution' in key:
    215                         solvetype = split('Solution', key)[0]
     216                        solvetype = re.split('Solution', key)[0]
    216217
    217218                #we save the results, scrap them and solve.
     
    224225                    try:
    225226                        #first look for indexing
    226                         if search(r'\d+$', fieldname):
    227                             index = int(search(r'\d+$', fieldname).group()) - 1
    228                             fieldname = fieldname[:search(r'\d+$', fieldname).start()]
     227                        if re.search(r'\d+$', fieldname):
     228                            index = int(re.search(r'\d+$', fieldname).group()) - 1
     229                            fieldname = fieldname[:re.search(r'\d+$', fieldname).start()]
    229230                        elif 'FirstStep' in fieldname:
    230231                            index = 0
    231                             fieldname = fieldname[:search('FirstStep', fieldname).start()]
     232                            fieldname = fieldname[:re.search('FirstStep', fieldname).start()]
    232233                        elif 'SecondStep' in fieldname:
    233234                            index = 1
    234                             fieldname = fieldname[:search('SecondStep', fieldname).start()]
     235                            fieldname = fieldname[:re.search('SecondStep', fieldname).start()]
    235236                        elif 'ThirdStep' in fieldname:
    236237                            index = 2
    237                             fieldname = fieldname[:search('ThirdStep', fieldname).start()]
     238                            fieldname = fieldname[:re.search('ThirdStep', fieldname).start()]
    238239                        else:
    239240                            index = 0
     
    270271                                    #probably severalmatches, we take the last one which should be the good one (Needs to be controled in the list above)
    271272                                    sufix = sufixes[np.squeeze(np.where([suf in fieldname for suf in sufixes]))[-1]]
    272                                 fieldname = fieldname[:search(sufix, fieldname).start()]
     273                                fieldname = fieldname[:re.search(sufix, fieldname).start()]
    273274                            elif fieldname.endswith("P") and index == 1:
    274275                                #we are looking for P2 but 2 as been considered as an index and so shifted by -1
Note: See TracChangeset for help on using the changeset viewer.