Ignore:
Timestamp:
03/21/16 15:55:15 (8 years ago)
Author:
labetoulle
Message:
  • Run everything (DB inserts + plots) from single bash script
  • Change exit codes (unsigned in bash, so no negative values...) :
    • 0: everything was ok;
    • 1: nothing done, 'cause nothing to do => ok;
    • >= 2: error.
  • DB access now needs password
  • plot_bilan: added date of production and plotted range to image
  • Cleaning (useless comments, ...)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • TOOLS/ConsoGENCI/trunk/bin/libconso_db.py

    r2775 r2783  
    2929 
    3030####################################################################### 
    31 def connect_db(db_host, db_name, db_user): 
     31def connect_db(db_host, db_name, db_user, db_pwd): 
    3232 
    33   conn_string = "host={} dbname={} user={}".format( 
    34     db_host, db_name, db_user 
     33  conn_string = "host={} dbname={} user={} password={}".format( 
     34    db_host, db_name, db_user, db_pwd 
    3535  ) 
    3636 
     
    4444  except Exception as rc: 
    4545    print("Problem with DB connect:\n{}".format(rc)) 
    46     exit(1) 
     46    exit(9) 
    4747 
    4848  # conn.cursor will return a cursor object, you can use this cursor 
     
    6363  except Exception as rc: 
    6464    print("Problem with select:\n{}".format(rc)) 
    65     exit(1) 
     65    exit(9) 
    6666 
    6767  # # retrieve the records from the database 
     
    8585  except Exception as rc: 
    8686    print("Problem with insert:\n{}".format(rc)) 
    87     exit(1) 
     87    exit(9) 
    8888 
    8989 
     
    9898  except Exception as rc: 
    9999    print("Problem with commit:\n{}".format(rc)) 
    100     exit(1) 
     100    exit(9) 
    101101 
    102102 
     
    110110  except Exception as rc: 
    111111    print("Problem with close:\n{}".format(rc)) 
    112     exit(1) 
     112    exit(9) 
    113113 
    114114 
Note: See TracChangeset for help on using the changeset viewer.