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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.