Changeset 23149


Ignore:
Timestamp:
08/21/18 13:06:49 (7 years ago)
Author:
kruegern
Message:

NEW: added python method of excluding tests in jenkins using test ids or words/sub-words from the test names. Fixed type in jenkins.sh. Testing exclusion of Dakota on linux64_ross only for now.

Location:
issm/trunk-jpl
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/jenkins/jenkins.sh

    r23060 r23149  
    245245        if [ $? -ne 0 ] && [ $NUMCPUS_INSTALL -gt 1 ]; then
    246246                echo " "
    247                 echo "Compilation failed, trying to compile with only one threatd"
     247                echo "Compilation failed, trying to compile with only one thread"
    248248                echo " "
    249249                make
  • issm/trunk-jpl/jenkins/linux64_ross

    r23120 r23149  
    2929
    3030#PYTHON and MATLAB testing
    31 MATLAB_TEST=1
     31MATLAB_TEST=0
    3232PYTHON_TEST=1
    3333
     
    3737
    3838#List of external packages to be installed and their installation scripts
    39 EXTERNALPACKAGES="autotools     install.sh
    40                                                 cmake        install.sh
    41                                                 mpich         install-3.2-linux64.sh
    42                                                 petsc         install-3.7-linux64.sh
    43                                                 triangle      install-linux64.sh
    44                                                 chaco         install.sh
    45                                                 m1qn3         install.sh
    46                                                 hdf5          install.sh
    47                                                 netcdf        install.sh
    48                                                 shell2junit   install.sh"
     39EXTERNALPACKAGES=""
    4940
    5041#-----------------#
     
    6354#by Matlab and runme.m
    6455#ex: "'id',[101 102 103]"
    65 PYTHON_NROPTIONS=""
     56PYTHON_NROPTIONS="--exclude_name 'Dakota'"
    6657MATLAB_NROPTIONS="'exclude',[IdFromString('Dakota')]"
  • issm/trunk-jpl/test/NightlyRun/IdFromString.py

    r20550 r23149  
    11#! /usr/bin/env python
    22from IdToName import IdToName
     3import os
    34
    4 def IdFromString(string):
     5# use verbose=False to print output when this is called by command line
     6def IdFromString(string,verbose=False):
    57        """
    68        IDFROMSTRING - output ids from a given string
    79 
    810            Usage:
    9                ids=IdFromString(string)
     11                ids=IdFromString(string)
    1012 
    1113            Examples:
    12                ids=IdFromString('Parallel')
    13                ids=IdFromString('79North')
    14                          ids=IdFromString('*')
     14                ids=IdFromString('Parallel')
     15                ids=IdFromString('79North')
     16                ids=IdFromString('*')
    1517        """
    1618
     
    1820        if not isinstance(string,str):
    1921                raise TypeError('IdFromString error message: input argument is not a string.')
     22        string = string.replace("'",'')
     23        string = string.replace('"','')
    2024
    21         #Get the dictionary and scan for matches
    22         idnames=IdToName(0)
    23         ids=[item[0] for item in idnames.iteritems() if string in item[1]]
     25        #Get the test ids and names and scan for matches
     26
     27        ids = []
     28        idnames = []
     29        for f in os.listdir('.'):
     30                if f.endswith('.py') and f.startswith('test'):
     31                        # all tests look like: "testwxyz.py" so 5th to 3rd to last is always the full id
     32                        s = int(f[4:-3])
     33                        name = IdToName(s)
     34                        if (string == '*') or (name != None and string in name):
     35                                ids.append(s)
     36                                idnames.append(name)
    2437
    2538        #Return if no test found
    2639        if not ids:
    27                 print "No test matches '%s'." % string
     40                if verbose:
     41                        print "No test matches '%s'." % string
     42                #else:
     43                        #print []
    2844                return ids
    2945
    3046        #Display names
     47        if verbose:
     48                idnames = [i for _,i in sorted(zip(ids,idnames), key=lambda pair: pair[0])]
     49
    3150        ids.sort()
    32         print "%d tests match '%s':" % (len(ids),string)
    33         for id in ids:
    34                 print "   %d : %s" % (id,idnames[id])
     51
     52        if verbose:
     53                print "%s tests match '%s':" % (len(ids),string)
     54                for i in range(len(ids)):
     55                        print "   %s : %s" % (ids[i],idnames[i])
     56        #else:
     57                #print ids
    3558
    3659        return ids
  • issm/trunk-jpl/test/NightlyRun/IdToName.py

    r21408 r23149  
    11#! /usr/bin/env python
    22
    3 def IdToName(id):
     3def IdToName(test_id):
    44        """
    55        IDTONAME- return name of test
    66 
    77            Usage:
    8                name=IdToName(id)
     8               name=IdToName(test_id)
    99        """
     10        #try:
     11        infile = open('test' + str(test_id) + '.py','r')
     12        file_text = infile.readline()
    1013
    11         infile  = open('test' + str(id) + '.py','r')
    12         file_text  = infile.readlines()
    13 
    14         string='#Test Name:'
    15         name=file_text[0]
    16         name=name[len(string)+1:-1]
     14        string = '#Test Name:'
     15        name = file_text[len(string)+1:-1]
    1716        return name
     17        #except IOError:
     18                # no test with that name, so ignore it
     19                #return None
  • issm/trunk-jpl/test/NightlyRun/runme.py

    r23130 r23149  
    66from glob import glob
    77from socket import gethostname
     8from IdFromString import *
    89
    910def runme(id=None,exclude=None,benchmark='nightly',procedure='check',output='none',rank=1,numprocs=1):
     
    2021            Available options:
    2122               'id'            followed by the list of ids requested
    22                'exclude'       ids to be excluded from the test
     23               'exclude'       ids or (parts of) test names to be excluded from the test
    2324               'benchmark'     'all' (all of the tests)
    2425                          'nightly' (nightly run/ daily run)
     
    3940               runme()
    4041               runme(exclude=101)
     42               runme(exclude='Dakota')
     43               runme(exclude=[[101,102],['Dakota','Slr']])
    4144               runme(id=102,procedure='update')
    4245        """
     
    9295        # }}}
    9396        #GET exclude {{{
    94         if exclude:
    95                 if isinstance(exclude,list):
    96                         exclude_ids=exclude
    97                 else:
    98                         exclude_ids=[exclude]
    99                 test_ids=test_ids.difference(set(exclude_ids))
    100 #       print 'test_ids after exclude =',test_ids
    101         # }}}
     97        exclude_ids = []
     98        if np.size(exclude) > 0:
     99                # 1 exclusion, either an id or a test name
     100                if type(exclude) == str:
     101                        exclude_ids = IdFromString(exclude)
     102                if type(exclude) == int:
     103                        exclude_ids = [exclude]
     104
     105                # many exclusions of either ids or test names
     106                if type(exclude) == list and len(exclude) > 0:
     107                        # is everything a string or int?
     108                        if np.array([type(i) == int for i in exclude]).all():
     109                                exclude_ids = exclude
     110                        elif np.array([type(i) == str for i in exclude]).all():
     111                                exclude_ids = np.concatenate([IdFromString(i) for i in exclude])
     112
     113                # many exclusions of both ids and test names
     114                # exclude[0] -> exclude by id
     115                # exclude[1] -> exclude by test name
     116                if type(exclude) == list and len(exclude) == 2:
     117                        if type(exclude[0]) == list and len(exclude[0]) > 0 and type(exclude[0][0]) == int:
     118                                exclude_ids = np.concatenate([exclude_ids,exclude[0]])
     119                        if type(exclude[1]) == list and len(exclude[1]) > 0 and type(exclude[1][0]) == str:
     120                                exclude_ids = np.concatenate([exclude_ids,np.concatenate([IdFromString(i) for i in exclude[1]])])
     121
     122                # no recognizable exclusion
     123                if np.size(exclude_ids) == 0:
     124                        print exclude
     125                        raise RuntimeError('''runme.py: exclude (-e/-exclude) and exclude-name (-en/-exclude_name) options must appear as one of the following:
     126
     127exclude=101                                     OR -e 101
     128exclude=\'Dakota\'                              OR -en 'Dakota'
     129exclude=[101,102...]                            OR -e 101 102 ...
     130exclude=[\'Dakota\',\'Slr\'...]                 OR -en 'Dakota' 'Slr' ...
     131exclude=[[101,102...],[\'Dakota\',\'Slr\'...]]  OR -e 101 102 ... -en 'Dakota' 'Slr' ...
     132''')
     133                test_ids=test_ids.difference(exclude_ids)
     134        print 'test_ids after exclude =',sorted(test_ids)
     135        # }}}
     136        return
    102137        #Process Ids according to benchmarks {{{
    103138        if benchmark=='nightly':
     
    248283        parser.add_argument('-i','--id', nargs='*', type=int, help='followed by the list of ids requested', default=[])
    249284        parser.add_argument('-e','--exclude', nargs='+', type=int, help='ids to be excluded from the test', default=[])
     285        parser.add_argument('-en','--exclude_name', nargs='+', type=str, help='test names to be excluded from the test', default=[])
    250286        parser.add_argument('-b','--benchmark', help='nightly/ismip/eismint/thermal/mesh/...', default='nightly')
    251287        parser.add_argument('-p','--procedure', help='check/update', default='check')
     
    255291        args = parser.parse_args()
    256292
    257         md = runme(args.id, args.exclude, args.benchmark, args.procedure, args.output, args.rank, args.numprocs)
     293        md = runme(args.id, [args.exclude,args.exclude_name], args.benchmark, args.procedure, args.output, args.rank, args.numprocs)
    258294
    259295        if args.output=='nightly':
Note: See TracChangeset for help on using the changeset viewer.