def main(): (opts, args) = getopts() if chkopts(opts) is True: return 1 try: input_db = Database(opts.input, encoding="utf-8", convert_unicode=True, assert_unicode=DEBUG, echo=DEBUG, echo_pool=DEBUG ) reload_mappers(input_db.get_metadata()) output_db = Database(opts.output, encoding="utf-8", convert_unicode=True, assert_unicode=DEBUG, echo=DEBUG, echo_pool=DEBUG ) reload_mappers(output_db.get_metadata()) except Exception, e: print >>sys.stderr, 'Initializing a database error' raise
def main(): (opts, args) = getopts() if chkopts(opts) is True: return PROCERROR cf = readconf(opts.config) if cf is None: print >>sys.stderr, 'Failed to load the config file "%s". (%s)' % (opts.config, sys.argv[0]) return PROCERROR # conf parse if parse_conf(cf) is False: return PROCERROR if reload_conf(cf["env.sys.log.conf.path"]): logger = logging.getLogger('pysilhouette.scheduler') else: print >>sys.stderr, 'Failed to load the log file. (%s)' % sys.argv[0] return PROCERROR try: try: signal.signal(signal.SIGTERM, sigterm_handler) scheduler = Scheduler(opts, cf) ret = scheduler.process() # start!! return ret except KeyboardInterrupt, k: logger.critical('Keyboard interrupt occurred. - %s' % str(k.args)) print >>sys.stderr, 'Keyboard interrupt occurred. - %s' % str(k.args) except Exception, e: logger.critical('A system error has occurred. - %s' % str(e.args)) print >>sys.stderr, 'A system error has occurred. - %s' % str(e.args) print >>sys.stderr, traceback.format_exc() t_logger = logging.getLogger('pysilhouette_traceback') t_logger.critical(traceback.format_exc())
def main(): global opts (opts, args) = getopts() if chkopts(opts) is True: return PROCERROR #### try: opts.config = os.path.abspath(opts.config) except AttributeError, e: print >>sys.stderr, 'No configuration file path.' return PROCERROR