def start(): try: settings=startup.read_settings() Log.start(settings.debug) main(settings) except Exception, e: Log.error("Problems exist", e)
def setUp(self): settings = startup.read_settings(filename="leak_check_settings.json") Log.start(settings.debug) self.private = ElasticSearch(settings.private) self.public = ElasticSearch(settings.public) self.public_comments = ElasticSearch(settings.public_comments) self.settings = settings
def start(): try: settings = startup.read_settings(defs=[{ "name": ["--quick", "--fast"], "help": "use this to process the first and last block, useful for testing the config settings before doing a full run", "action": "store_true", "dest": "quick" }, { "name": ["--restart", "--reset", "--redo"], "help": "use this to force a reprocessing of all data", "action": "store_true", "dest": "restart" }]) with startup.SingleInstance(flavor_id=settings.args.filename): if settings.args.restart: for l in struct.listwrap(settings.debug.log): if l.filename: File(l.filename).parent.delete() File(settings.param.first_run_time).delete() File(settings.param.last_run_time).delete() Log.start(settings.debug) main(settings) except Exception, e: Log.fatal("Can not start", e)
def start(): try: settings = startup.read_settings() Log.start(settings.debug) main(settings, restart=True) except Exception, e: Log.error("Can not start", e)
def error(results): settings = startup.read_settings() content = [] for e in results.errors: content.append("FAIL: " + str(e[0]._testMethodName)) for f in results.failures: content.append("FAIL: " + str(f[0]._testMethodName)) Emailer(settings.email).send_email(text_data="\n".join(content))
def test_replication(): try: settings=startup.read_settings(filename="replication_settings.json") Log.start(settings.debug) source=ElasticSearch(settings.source) destination=replicate.get_or_create_index(settings["destination"], source) replicate.replicate(source, destination, [537285], CNV.string2datetime("19900101", "%Y%m%d")) finally: Log.stop()
def error(results): settings = startup.read_settings() content = [] for e in results.errors: content.append("FAIL: "+str(e[0]._testMethodName)) for f in results.failures: content.append("FAIL: "+str(f[0]._testMethodName)) Emailer(settings.email).send_email( text_data = "\n".join(content) )
def test_replication(): try: settings = startup.read_settings(filename="replication_settings.json") Log.start(settings.debug) source = ElasticSearch(settings.source) destination = replicate.get_or_create_index(settings["destination"], source) replicate.replicate(source, destination, [537285], CNV.string2datetime("19900101", "%Y%m%d")) finally: Log.stop()
def main(): """ MEANT TO BE RUN JUST ONCE IN DEVELOPMENT TO CONVERT A BIG PUBLIC DATABASE (8G+) INTO A TINY TESTING DB (FOR ADDING TO REPOSITORY) """ try: settings=startup.read_settings() Log.start(settings.debug) input=raw_input("We are going to totally wipe out the "+settings.bugzilla.schema.upper()+" schema at "+settings.bugzilla.host.upper()+"! Type \"YES\" to continue: ") if input!="YES": Log.note("Aborted. No Changes made.") return Log.note("Scrubbing db of those pesky records.") Log.note("This is going to take hours ...") DB.execute_file(settings.bugzilla, "./tests/resources/sql/scrub_db.sql", { "schema":settings.bugzilla.schema, "bug_list":SQL(settings.param.bugs) }) Log.note("... Done!") finally: Log.stop()
def setUp(self): self.settings = startup.read_settings(filename="test_settings.json") Log.start(self.settings.debug)