Commit fd3ded42 authored by Tomas Krizek's avatar Tomas Krizek

orchestrator: don't create JSON datafile

parent 92622ed2
......@@ -3,38 +3,13 @@
import argparse
import logging
import multiprocessing.pool as pool
import os
import time
import sys
import cli
from dataformat import DiffReport
from dbhelper import LMDB, MetaDatabase
import sendrecv
def export_statistics(lmdb, datafile, start_time):
qdb = lmdb.get_db(LMDB.QUERIES)
adb = lmdb.get_db(LMDB.ANSWERS)
with lmdb.env.begin() as txn:
total_queries = txn.stat(qdb)['entries']
total_answers = txn.stat(adb)['entries']
report = DiffReport(
start_time,
int(time.time()),
total_queries,
total_answers)
# it doesn't make sense to use existing report.json in orchestrator
if os.path.exists(datafile):
backup_filename = datafile + '.bak'
os.rename(datafile, backup_filename)
logging.warning(
'JSON report already exists, overwriting file. Original '
'file backed up as %s', backup_filename)
report.export_json(datafile)
def main():
cli.setup_logging()
parser = argparse.ArgumentParser(
......@@ -42,14 +17,11 @@ def main():
'listed in configuration file, and record answers into LMDB')
cli.add_arg_envdir(parser)
cli.add_arg_config(parser)
cli.add_arg_datafile(parser)
parser.add_argument('--ignore-timeout', action="store_true",
help='continue despite consecutive timeouts from resolvers')
args = parser.parse_args()
sendrecv.module_init(args)
datafile = cli.get_datafile(args, check_exists=False)
start_time = int(time.time())
with LMDB(args.envdir) as lmdb:
meta = MetaDatabase(lmdb)
......@@ -82,9 +54,6 @@ def main():
txn.commit()
meta.write_end_time()
# get query/answer statistics
export_statistics(lmdb, datafile, start_time)
if __name__ == "__main__":
main()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment