Changeset 2fb99de in flex_extract.git for python/tools.py


Ignore:
Timestamp:
Sep 20, 2018, 11:56:37 AM (6 years ago)
Author:
Anne Philipp <anne.philipp@…>
Branches:
master, ctbto, dev
Children:
5d42acd
Parents:
3232589
Message:

introduced config with path definitions and changed py files accordingly; Installation works; some tests were added for tarball making; Problems in submission to ecgate

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/tools.py

    refa05d7 r2fb99de  
    124124    parser.add_argument("--debug", dest="debug", default=None,
    125125                        help="debug mode - leave temporary files intact")
     126    parser.add_argument("--request", dest="request", default=None,
     127                        help="list all mars request in file mars_requests.dat \
     128                        and skip submission to mars")
    126129
    127130    args = parser.parse_args()
     
    137140    @Input:
    138141        filename: string
    139             Name of file where the ECMWV environment parameters are stored.
     142            Path to file where the ECMWV environment parameters are stored.
    140143
    141144    @Return:
    142145        envs: dict
     146            Contains the environment parameter ecuid, ecgid, gateway
     147            and destination for ECMWF server environments.
    143148    '''
    144149    envs= {}
    145     print filename
     150
    146151    with open(filename, 'r') as f:
    147152        for line in f:
     
    175180    '''
    176181
    177     print "clean_up"
     182    print("clean_up")
    178183
    179184    cleanlist = glob.glob(c.inputdir + "/*")
     
    184189            silent_remove(clist)
    185190
    186     print "Done"
     191    print("Done")
    187192
    188193    return
     
    208213    '''
    209214
    210     print message
     215    print(message)
    211216
    212217    # comment if user does not want email notification directly from python
     
    224229            pout = p.communicate(input=message + '\n\n' + trace)[0]
    225230        except ValueError as e:
    226             print 'ERROR: ', e
     231            print('ERROR: ', e)
    227232            sys.exit('Email could not be sent!')
    228233        else:
    229             print 'Email sent to ' + os.path.expandvars(user) + ' ' + \
    230                   pout.decode()
     234            print('Email sent to ' + os.path.expandvars(user) + ' ' +
     235                  pout.decode())
    231236
    232237    sys.exit(1)
     
    253258
    254259    '''
    255     print message
     260    print(message)
    256261
    257262    # comment if user does not want notification directly from python
     
    268273            pout = p.communicate(input=message+'\n\n')[0]
    269274        except ValueError as e:
    270             print 'ERROR: ', e
    271             print 'Email could not be sent!'
     275            print('ERROR: ', e)
     276            print('Email could not be sent!')
    272277        else:
    273             print 'Email sent to ' + os.path.expandvars(user) + ' ' + \
    274                   pout.decode()
     278            print('Email sent to ' + os.path.expandvars(user) + ' ' +
     279                  pout.decode())
    275280
    276281    return
     
    392397                break
    393398        else:
    394             print 'Warning: par ' + par + ' not found in table 128'
     399            print('Warning: par ' + par + ' not found in table 128')
    395400
    396401    return ipar
     
    438443            raise # re-raise exception if a different error occured
    439444        else:
    440             print 'WARNING: Directory {0} already exists!'.format(directory)
     445            print('WARNING: Directory {0} already exists!'.format(directory))
    441446
    442447    return
     
    482487                                         stderr=subprocess.STDOUT)
    483488    except subprocess.CalledProcessError as e:
    484         print '... ERROR CODE:\n ... ', e.returncode
    485         print '... ERROR MESSAGE:\n ... ', e
    486         print '... COMMAND MESSAGE:\n ...', e.output
    487 
    488         print '\nDo you have a valid eccert key?'
     489        print('... ERROR CODE:\n ... ' + str(e.returncode))
     490        print('... ERROR MESSAGE:\n ... ' + str(e))
     491
     492        print('\n... Do you have a valid ecaccess certification key?')
    489493        sys.exit('... ECACCESS-FILE-PUT FAILED!')
    490494
     
    520524                                         jobname])
    521525    except subprocess.CalledProcessError as e:
    522         print '... ERROR CODE: ', e.returncode
    523         print '... ERROR MESSAGE:\n ... ', e
    524         print '... COMMAND MESSAGE:\n ...', e.output
    525 
    526         print '\nDo you have a valid eccert key?'
     526        print('... ERROR CODE:\n ... ' + str(e.returncode))
     527        print('... ERROR MESSAGE:\n ... ' + str(e))
     528
     529
     530        print('\n... Do you have a valid ecaccess certification key?')
    527531        sys.exit('... ECACCESS-JOB-SUBMIT FAILED!')
    528532
Note: See TracChangeset for help on using the changeset viewer.
hosted by ZAMG