from datetime import datetime
from ..recid_rules_db.load import db_load
from traceback import format_exc, extract_stack, format_list

def run(**opt):    
    print "Starting recidivism database load at %s:" % (datetime.now().isoformat(' '))
    
    try:
        db_load(opt['segment'], **opt)
        print "Finished database load at %s:" % (datetime.now().isoformat(' '))
        return 1
    except:
        if kw['verbose']:
            raise
        return (format_exc(), format_list(extract_stack())) 