[Zodb-checkins] CVS: ZODB3/Tools - create.py:1.1.2.1
Jeremy Hylton
jeremy@zope.com
Tue, 17 Dec 2002 11:44:17 -0500
Update of /cvs-repository/ZODB3/Tools
In directory cvs.zope.org:/tmp/cvs-serv16263
Added Files:
Tag: ZODB3-fast-restart-branch
create.py
Log Message:
Create a large Data.fs at a storage server on guido's machine
=== Added File ZODB3/Tools/create.py ===
#! /usr/bin/env python2.1
"""Create a large Data.fs"""
import random
import ZODB
from ZODB.tests.MinPO import MinPO
from ZEO.ClientStorage import ClientStorage
from BTrees.OOBTree import OOBTree
SERVER = "guido", 9000
MB = 1024**2
CACHE_SIZE = 200 * MB
CLIENT = "cache"
RECONNECT_TIMEOUT = 10
MAX_OBJ_SIZE = 10000
NUM_OBJS = 10000
def main():
cs = ClientStorage(SERVER, cache_size=CACHE_SIZE, client=CLIENT,
max_disconnect_poll=RECONNECT_TIMEOUT)
db = ZODB.DB(cs)
cn = db.open()
rt = cn.root()
objs = rt["objects"] = OOBTree()
get_transaction().commit()
i = 0
for j in xrange(NUM_OBJS):
size = 2 ** random.randint(1, 20)
po = MinPO("x" * size)
objs[i] = po
print "object", i, "size", size
i += 1
if i % 100 == 0:
get_transaction().commit()
if __name__ == "__main__":
main()