Changeset 27782


Ignore:
Timestamp:
06/05/23 14:08:11 (22 months ago)
Author:
jdquinn
Message:

BUG: Allow runme to be called as function or script.

File:
1 edited

Legend:

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

    r27781 r27782  
    123123    i1, i2 = parallelrange(rank, numprocs, len(list_ids))  # Get tests for this CPU only
    124124    list_ids = list_ids[i1:i2 + 1]
    125     if id is not None:
    126         if np.size(id) > 0 or (len(id[0]) > 0 or len(id[1]) > 0):
    127             test_ids = set(GetIds(id)).intersection(set(list_ids))
    128             benchmark = None
    129         else:
    130             print(('runme error: \'id\' argument "{}" does not follow the required protocol. When calling runme as a function from Python runtime, use runme(<int>). If calling runme.py from command line, use runme.py <options>'.format(id)))
    131             exit()
     125    # Check if we are calling runme as a function with a single integer or string argument and, if so, convert to the proper protocol
     126    if isinstance(id, int):
     127        id = str(id)
     128    if isinstance(id, str):
     129        id = [[id], []]
     130    if len(id[0]) > 0 or len(id[1]) > 0:
     131        test_ids = set(GetIds(id)).intersection(set(list_ids))
     132        benchmark = None
    132133    else:
    133134        # If no tests are specifically provided, do them all
Note: See TracChangeset for help on using the changeset viewer.