def run(argv): global n,c,r n = int(argv[1]) c = int(argv[2]) r = 600 config.configure() try: print '%d existing events' % ( model.event.m.find().count()) # h.setup_time_aggregates() model.event.m.ensure_indexes() except: log.exception('Error initializing mongo') jobs = [ gevent.spawn(runner, n//c, r/float(c)) for x in xrange(c) ] with timing() as t: gevent.joinall(jobs) print '%d events in %.2f s, %.0f r/s' % ( n, t[0], float(n)/(t[0])) return agg_defs = model.AggDef.query.find().all() for ad in agg_defs: print print '=== Aggregate:', ad.name, '===' # updated = ad.incremental() # updated = ad.full() for doc in ad.collection.find().sort('_id'): print '%8s: %s' % (doc['_id'], doc['value'])
def make_command(cmd, *args): # somewhat duplicated from scripts/zcmd args = list(args) options, args = config.configure(args) Command = zarkov.command.Command.lookup(cmd) return Command(options, *args)