Changeset 6808


Ignore:
Timestamp:
Apr 15, 2009, 9:40:55 AM (15 years ago)
Author:
rwilson
Message:

Improved error handling.

Location:
branches/numpy_anuga_validation/automated_validation_tests/patong_beach_validation
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/numpy_anuga_validation/automated_validation_tests/patong_beach_validation/cmpsww.py

    r6789 r6808  
    346346                           timesteps=timesteps, variables=variables)
    347347    except RuntimeError, msg:
    348          print >>sys.stderr, msg
     348         print msg
     349         return 10
    349350
    350351
  • branches/numpy_anuga_validation/automated_validation_tests/patong_beach_validation/validate_patong.py

    r6788 r6808  
    1919
    2020# base URL for the remote ANUGA data
    21 PATONG_DATA_URL = 'http://10.7.64.243/patong_validation_data/'
     21PATONG_HOST = 'http://10.7.64.243/'
     22PATONG_DATA_URL = PATONG_HOST + 'patong_validation_data/'
    2223
    2324# path to the local data directory
     
    150151   
    151152    Return True if we *can* run, else False.
     153
     154    Tell user what is happening first, then untar files.
    152155    '''
    153156
    154157    log.critical('Checking if you have the required files ...')
     158
     159    have_files = True
     160    max_width = 0
     161    for obj in Local_Data_Objects:
     162        max_width = max(len(obj), max_width)
    155163
    156164    for obj in Local_Data_Objects:
     
    158166        obj_path = os.path.join(Local_Data_Directory, obj+'.tgz')
    159167        if os.path.exists(obj_path):
    160             log.debug('Untarring %s in directory %s'
    161                       % (obj_path, Local_Data_Directory))
    162             untar_file(obj_path, target_dir=Local_Data_Directory)
     168            log.info('%s  found' % obj.ljust(max_width))
    163169        else:
    164             return False
    165 
    166     log.critical('You appear to have the required files here, '
    167                  'continuing the validation.')
     170            log.info('%s  MISSING!' % obj.ljust(max_width))
     171            have_files = False
     172
     173    if not have_files:
     174        log.critical('You must obtain the missing files before you can run '
     175                     'this validation.')
     176        return False
     177
     178    log.critical('You have the required files.')
     179
     180    # now untar file/directory objects
     181    for obj in Local_Data_Objects:
     182        log.debug('Untarring %s in directory %s'
     183                  % (obj_path, Local_Data_Directory))
     184        untar_file(obj_path, target_dir=Local_Data_Directory)
     185
    168186    return True
    169187
     
    223241    else:
    224242        log.critical('Simulation results are NOT as expected.')
     243        fd = open('cmpsww.stdout', 'r')
     244        cmp_error = fd.readlines()
     245        fd.close()
     246        log.critical('\n' + ''.join(cmp_error))
    225247
    226248
     
    283305        log.critical('Terminating the validation.')
    284306        log.critical('')
    285         log.critical('If you get these files from %s:' % PATONG_DATA_URL)
    286         for obj in Local_Data_Objects:
    287             log.critical('    %s.tgz' % obj)
     307        log.critical('If you get the missing files from %s' % PATONG_DATA_URL)
    288308        log.critical('then you can try to run the validation again.')
    289309        sys.exit(10)
Note: See TracChangeset for help on using the changeset viewer.