comparison scripts/dump_dbm_sessions_db.py @ 6638:e1588ae185dc issue2550923_computed_property

merge from default branch. Fix travis.ci so CI builds don't error out
author John Rouillard <rouilj@ieee.org>
date Thu, 21 Apr 2022 16:54:17 -0400
parents 61481d7bbb07
children 1188bb423f92
comparison
equal deleted inserted replaced
6508:85db90cc1705 6638:e1588ae185dc
1 #! /usr/bin/env python3
2 """Usage: dump_dbm_sessions_db.py [filename]
3
4 Simple script to dump the otks and sessions dbm databases. Dumps
5 sessions db in current directory if no argument is given.
6
7 Dump format:
8
9 key: <timestamp> data
10
11 where <timestamp> is the human readable __timestamp decoded from the
12 data object.
13
14 """
15
16 import dbm, marshal, sys
17 from datetime import datetime
18
19 try:
20 file = sys.argv[1]
21 except IndexError:
22 file="sessions"
23
24 try:
25 db = dbm.open(file)
26 except Exception:
27 print("Unable to open database: %s"%file)
28 exit(1)
29
30 k = db.firstkey()
31 while k is not None:
32 d = marshal.loads(db[k])
33 t = datetime.fromtimestamp(d['__timestamp'])
34 print("%s: %s %s"%(k, t, d))
35 k = db.nextkey(k)

Roundup Issue Tracker: http://roundup-tracker.org/