def main(): # noinspection PyUnresolvedReferences import log_configuration if len(sys.argv) < 2: log.error("Usage: %s <config_file>", sys.argv[0]) exit(1) conf = Configuration(sys.argv[1]) with get_session() as session: db_version = get_db_version(session) if db_version != 3: log.error("Invalid database version (%d). 3 expected", db_version) session.close() exit(1) session.close() mail_verifier = mail.Verifier() mega_verifier = mega.Verifier() def signal_handler(signal, frame): print "Abort signal received!!!!" mail_verifier.stop() mega_verifier.stop() signal.signal(signal.SIGINT, signal_handler) for mail_conf in conf.mail_confs: mail_verifier.verify(mail_conf) for meaga_conf in conf.mega_confs: mega_verifier.verify(meaga_conf) mail_verifier.close() mega_verifier.close()
def main(): if len(sys.argv) < 3: log.error("Usage: %s <config_file> <input path> [<input path> ...]", sys.argv[0]) exit(1) settings = Settings(sys.argv[1]) with get_session() as session: db_version = get_db_version(session) if db_version != 3: log.error("Invalid database version (%d). 3 expected" % db_version) session.close() exit(1) app = App(settings, session) workers.manager.register_app(app) in_files = sys.argv[2:] PipelineFlusher(remaining_inputs=len(in_files)).register(app) # load files to read for file_path in in_files: event = events.NewInputPath(file_path) event.complete = True app.fire(event) session.close() if settings.debugging.enabled: from fcb.utils.debugging import configure_signals configure_signals() app += Debugger() app.run() log.debug("finished processing")