rem
stringlengths 1
322k
| add
stringlengths 0
2.05M
| context
stringlengths 4
228k
| meta
stringlengths 156
215
|
---|---|---|---|
id=thread.get_ident()
|
id=get_id()
|
def get_transaction(): id=thread.get_ident() try: theTransaction=theTransactions[id] except KeyError: theTransactions[id]=theTransaction=Transaction() return theTransaction
|
1128202c6b4dfd09b57108947d145ce11d93bcd3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/1128202c6b4dfd09b57108947d145ce11d93bcd3/Transaction.py
|
id=thread.get_ident()
|
id=get_id()
|
def abort(self):
|
1128202c6b4dfd09b57108947d145ce11d93bcd3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/1128202c6b4dfd09b57108947d145ce11d93bcd3/Transaction.py
|
print sys.path
|
def main(): import sys, getopt name_of_test = '' opts, args = getopt.getopt(sys.argv[1:], 'n:') for flag, val in opts: if flag == '-n': name_of_test = val if args: print "Did not expect arguments. Got %s" % args return 0 tests = makeTestSuite(name_of_test) runner = unittest.TextTestRunner() runner.run(tests)
|
933086e323d581c72afc53baccb4322eb2f3f3e8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/933086e323d581c72afc53baccb4322eb2f3f3e8/testZEO.py
|
|
self.assert_(not self._storage.is_connected()) zLOG.LOG("testZEO", zLOG.INFO, "WHY DOES THIS HANG???")
|
def checkReconnectUpgrade(self): # A fallback client reconnects from a read-only to a # read-write server
|
f53657760eb1b1630b9963a4569542f1139f318e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/f53657760eb1b1630b9963a4569542f1139f318e/testZEO.py
|
|
self._startServer(create=0) self.pollUp() self._dostore()
|
def checkReconnectUpgrade(self): # A fallback client reconnects from a read-only to a # read-write server
|
f53657760eb1b1630b9963a4569542f1139f318e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/f53657760eb1b1630b9963a4569542f1139f318e/testZEO.py
|
|
__version__='$Revision: 1.5 $'[11:-2]
|
__version__='$Revision: 1.6 $'[11:-2]
|
def info(RESPONSE): RESPONSE['Content-type']= 'text/plain'
|
65e2443f357ea0ad5e5ee882ddef05d332cf477b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/65e2443f357ea0ad5e5ee882ddef05d332cf477b/DemoStorage.py
|
def __init__(self, file_name, create=0, read_only=0, stop=None, base=None):
|
def __init__(self, file_name, create=0, read_only=0, stop=None):
|
def __init__(self, file_name, create=0, read_only=0, stop=None, base=None):
|
8b3aaff8e01d101ed66caf364214b0f4e5ec8a8f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/8b3aaff8e01d101ed66caf364214b0f4e5ec8a8f/FileStorage.py
|
self._base=base
|
def __init__(self, file_name, create=0, read_only=0, stop=None, base=None):
|
8b3aaff8e01d101ed66caf364214b0f4e5ec8a8f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/8b3aaff8e01d101ed66caf364214b0f4e5ec8a8f/FileStorage.py
|
|
try: try: return self._load(oid, version, self._index, self._file) except: if self._base is not None: return self._base.load(oid, version) raise
|
try: return self._load(oid, version, self._index, self._file)
|
def load(self, oid, version, _stuff=None): self._lock_acquire() try: try: return self._load(oid, version, self._index, self._file) except: if self._base is not None: return self._base.load(oid, version) raise finally: self._lock_release()
|
8b3aaff8e01d101ed66caf364214b0f4e5ec8a8f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/8b3aaff8e01d101ed66caf364214b0f4e5ec8a8f/FileStorage.py
|
for version in self._vindex.keys()[:max]:
|
keys=self._vindex.keys() if max is not None: keys=keys[:max] for version in keys:
|
def versions(self, max=None): r=[] a=r.append for version in self._vindex.keys()[:max]: if self.versionEmpty(version): continue a(version) if max and len(r) >= max: return r
|
8b3aaff8e01d101ed66caf364214b0f4e5ec8a8f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/8b3aaff8e01d101ed66caf364214b0f4e5ec8a8f/FileStorage.py
|
if self.filter is None or self.filter(dict):
|
if dict is not None and (self.filter is None or self.filter(dict)):
|
def search(self): """Search for another record.""" dict = self._readnext() if self.filter is None or self.filter(dict): if self.i >= self.first: self.results.append(dict) self.i += 1
|
43abd23e91ba5ed60a49ec24e9b1048e21eb39ef /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/43abd23e91ba5ed60a49ec24e9b1048e21eb39ef/FileStorage.py
|
def checkTcpAbortAfterCommit(self):
|
def checkTpcAbortAfterCommit(self):
|
def checkTcpAbortAfterCommit(self): obj = StubObject() self.datamgr.add(obj) oid = obj._p_oid
|
293a358c50c826a69f9063c4605ba9f2e0536492 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/293a358c50c826a69f9063c4605ba9f2e0536492/testConnection.py
|
self.assert_(msg.startswith("getTransaction() is deprecated."))
|
self.assert_( msg.startswith("setLocalTransaction() is deprecated.") or msg.startswith("getTransaction() is deprecated."))
|
def checkLocalTransactions(self): # Test of transactions that apply to only the connection, # not the thread. conn1 = self._db.open() conn2 = self._db.open() hook = WarningsHook() hook.install() try: conn1.setLocalTransaction() conn2.setLocalTransaction() r1 = conn1.root() r2 = conn2.root() if r1.has_key('item'): del r1['item'] conn1.getTransaction().commit() r1.get('item') r2.get('item') r1['item'] = 1 conn1.getTransaction().commit() self.assertEqual(r1['item'], 1) # r2 has not seen a transaction boundary, # so it should be unchanged. self.assertEqual(r2.get('item'), None) conn2.sync() # Now r2 is updated. self.assertEqual(r2['item'], 1)
|
62447db42e75139604838d7b0faab67b09312c4b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/62447db42e75139604838d7b0faab67b09312c4b/testZODB.py
|
recover(inp, outp, verobse, partial, force, pack)
|
recover(inp, outp, verbose, partial, force, pack)
|
def main(): try: opts, (inp, outp) = getopt.getopt(sys.argv[1:], 'fv:pP:') except getopt.error: die() print __doc__ % argv[0] force = partial = verbose = 0 pack = None for opt, v in opts: if opt == '-v': verbose = int(v) elif opt == '-p': partial = 1 elif opt == '-f': force = 1 elif opt == '-P': pack = time.time() - float(v) recover(inp, outp, verobse, partial, force, pack)
|
d680d201900dcc93b4fb054ecf8297aeb91456ce /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/d680d201900dcc93b4fb054ecf8297aeb91456ce/fsrecover.py
|
wait_for_server_on_starup=1):
|
wait_for_server_on_startup=1):
|
def __init__(self, connection, storage='1', cache_size=20000000, name='', client='', debug=0, var=None, min_disconnect_poll=5, max_disconnect_poll=300, wait_for_server_on_starup=1):
|
96b296e16a7852fb5728f50ae67854b4f9ace1f8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/96b296e16a7852fb5728f50ae67854b4f9ace1f8/ClientStorage.py
|
self._wait_for_server_on_starup=wait_for_server_on_starup
|
self._wait_for_server_on_startup=wait_for_server_on_startup
|
def __init__(self, connection, storage='1', cache_size=20000000, name='', client='', debug=0, var=None, min_disconnect_poll=5, max_disconnect_poll=300, wait_for_server_on_starup=1):
|
96b296e16a7852fb5728f50ae67854b4f9ace1f8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/96b296e16a7852fb5728f50ae67854b4f9ace1f8/ClientStorage.py
|
if not self._call.connect(not self._wait_for_server_on_starup):
|
if not self._call.connect(not self._wait_for_server_on_startup):
|
def _startup(self):
|
96b296e16a7852fb5728f50ae67854b4f9ace1f8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/96b296e16a7852fb5728f50ae67854b4f9ace1f8/ClientStorage.py
|
def undoInfo(self, first, last, specification):
|
def undoInfo(self, first=0, last=-20, specification=None):
|
def undoInfo(self, first, last, specification): self._lock_acquire() try: return self._call('undoInfo', first, last, specification) finally: self._lock_release()
|
96b296e16a7852fb5728f50ae67854b4f9ace1f8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/96b296e16a7852fb5728f50ae67854b4f9ace1f8/ClientStorage.py
|
if create: raise ValueError, "can\'t create a read-only file"
|
if create: raise ValueError, "can\'t create a read-only file"
|
def __init__(self, file_name, create=0, read_only=0, stop=None):
|
23e98ba0031035abd31aa228943da5682ae0a58b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/23e98ba0031035abd31aa228943da5682ae0a58b/FileStorage.py
|
self._file=file=open(file_name,'w+b') self._file.write(packed_version) self._pos=4 self._oid='\0\0\0\0\0\0\0\0' return if os.path.exists(file_name):
|
file=open(file_name,'w+b') file.write(packed_version) else:
|
def __init__(self, file_name, create=0, read_only=0, stop=None):
|
23e98ba0031035abd31aa228943da5682ae0a58b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/23e98ba0031035abd31aa228943da5682ae0a58b/FileStorage.py
|
else: if read_only: raise ValueError, "can\'t create a read-only file" file=open(file_name,'w+b')
|
def __init__(self, file_name, create=0, read_only=0, stop=None):
|
23e98ba0031035abd31aa228943da5682ae0a58b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/23e98ba0031035abd31aa228943da5682ae0a58b/FileStorage.py
|
|
INSTANCE_HOME=os.environ.get('INSTANCE_HOME', directory(me, 4))
|
if os.environ.has_key('INSTANCE_HOME'): INSTANCE_HOME=os.environ['INSTANCE_HOME'] elif os.path.isdir(os.path.join(directory(me, 4),'var')): INSTANCE_HOME=directory(me, 4) else: INSTANCE_HOME=os.getcwd() if os.path.isdir(os.path.join(INSTANCE_HOME, 'var')): var=os.path.join(INSTANCE_HOME, 'var') else: var=INSTANCE_HOME
|
def main(argv): me=argv[0] sys.path[:]==filter(None, sys.path) sys.path.insert(0, directory(me, 2)) args=[] last='' for a in argv[1:]: if (a[:1] != '-' and string.find(a, '=') > 0 and last != '-S' # lame, sorry ): a=string.split(a,'=') os.environ[a[0]]=string.join(a[1:],'=') continue args.append(a) last=a INSTANCE_HOME=os.environ.get('INSTANCE_HOME', directory(me, 4)) zeo_pid=os.environ.get('ZEO_SERVER_PID', os.path.join(INSTANCE_HOME, 'var', 'ZEO_SERVER.pid') ) opts, args = getopt.getopt(args, 'p:Dh:U:sS:u:') fs=os.path.join(INSTANCE_HOME, 'var', 'Data.fs') usage="""%s [options] [filename] where options are: -D -- Run in debug mode -U -- Unix-domain socket file to listen on -u username or uid number The username to run the ZEO server as. You may want to run the ZEO server as 'nobody' or some other user with limited resouces. The only works under Unix, and if the storage server is started by root. -p port -- port to listen on -h adddress -- host address to listen on -s -- Don't use zdeamon -S storage_name=module_path:attr_name -- A storage specification where: storage_name -- is the storage name used in the ZEO protocol. This is the name that you give as the optional 'storage' keyword argument to the ClientStorage constructor. module_path -- This is the path to a Python module that defines the storage object(s) to be served. The module path should ommit the prefix (e.g. '.py'). attr_name -- This is the name to which the storage object is assigned in the module. if no file name is specified, then %s is used. """ % (me, fs) port=None debug=0 host='' unix=None Z=1 UID='nobody' for o, v in opts: if o=='-p': port=string.atoi(v) elif o=='-h': host=v elif o=='-U': unix=v elif o=='-u': UID=v elif o=='-D': debug=1 elif o=='-s': Z=0 try: from ZServer.medusa import asyncore sys.modules['asyncore']=asyncore except: pass if port is None and unix is None: print usage print 'No port specified.' sys.exit(1) if args: if len(args) > 1: print usage print 'Unrecognizd arguments: ', string.join(args[1:]) sys.exit(1) fs=args[0] __builtins__.__debug__=debug if debug: os.environ['Z_DEBUG_MODE']='1' from zLOG import LOG, INFO, ERROR # Try to set uid to "-u" -provided uid. # Try to set gid to "-u" user's primary group. # This will only work if this script is run by root. try: import pwd try: try: UID=string.atoi(UID) except: pass gid = None if type(UID) == type(""): uid = pwd.getpwnam(UID)[2] gid = pwd.getpwnam(UID)[3] elif type(UID) == type(1): uid = pwd.getpwuid(UID)[2] gid = pwd.getpwuid(UID)[3] else: raise KeyError try: if gid is not None: try: os.setgid(gid) except OSError: pass os.setuid(uid) except OSError: pass except KeyError: LOG('ZEO Server', ERROR, ("can't find UID %s" % UID)) except: pass if Z: try: import posix except: pass else: import zdaemon zdaemon.run(sys.argv, '') import ZEO.StorageServer, asyncore storages={} for o, v in opts: if o=='-S': n, m = string.split(v,'=') if string.find(m,':'): # we got an attribute name m, a = string.split(m,':') else: # attribute name must be same as storage name a=n storages[n]=get_storage(m,a) if not storages: import ZODB.FileStorage storages['1']=ZODB.FileStorage.FileStorage(fs) # Try to set up a signal handler try: import signal signal.signal(signal.SIGTERM, lambda sig, frame, s=storages: shutdown(s) ) signal.signal(signal.SIGINT, lambda sig, frame, s=storages: shutdown(s, 0) ) signal.signal(signal.SIGHUP, rotate_logs_handler) finally: pass items=storages.items() items.sort() for kv in items: LOG('ZEO Server', INFO, 'Serving %s:\t%s' % kv) if not unix: unix=host, port ZEO.StorageServer.StorageServer(unix, storages) open(zeo_pid,'w').write("%s %s" % (os.getppid(), os.getpid())) asyncore.loop()
|
394d2e4a344463769b2015545975694678298cf2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/394d2e4a344463769b2015545975694678298cf2/start.py
|
os.path.join(INSTANCE_HOME, 'var', 'ZEO_SERVER.pid')
|
os.path.join(var, 'ZEO_SERVER.pid')
|
def main(argv): me=argv[0] sys.path[:]==filter(None, sys.path) sys.path.insert(0, directory(me, 2)) args=[] last='' for a in argv[1:]: if (a[:1] != '-' and string.find(a, '=') > 0 and last != '-S' # lame, sorry ): a=string.split(a,'=') os.environ[a[0]]=string.join(a[1:],'=') continue args.append(a) last=a INSTANCE_HOME=os.environ.get('INSTANCE_HOME', directory(me, 4)) zeo_pid=os.environ.get('ZEO_SERVER_PID', os.path.join(INSTANCE_HOME, 'var', 'ZEO_SERVER.pid') ) opts, args = getopt.getopt(args, 'p:Dh:U:sS:u:') fs=os.path.join(INSTANCE_HOME, 'var', 'Data.fs') usage="""%s [options] [filename] where options are: -D -- Run in debug mode -U -- Unix-domain socket file to listen on -u username or uid number The username to run the ZEO server as. You may want to run the ZEO server as 'nobody' or some other user with limited resouces. The only works under Unix, and if the storage server is started by root. -p port -- port to listen on -h adddress -- host address to listen on -s -- Don't use zdeamon -S storage_name=module_path:attr_name -- A storage specification where: storage_name -- is the storage name used in the ZEO protocol. This is the name that you give as the optional 'storage' keyword argument to the ClientStorage constructor. module_path -- This is the path to a Python module that defines the storage object(s) to be served. The module path should ommit the prefix (e.g. '.py'). attr_name -- This is the name to which the storage object is assigned in the module. if no file name is specified, then %s is used. """ % (me, fs) port=None debug=0 host='' unix=None Z=1 UID='nobody' for o, v in opts: if o=='-p': port=string.atoi(v) elif o=='-h': host=v elif o=='-U': unix=v elif o=='-u': UID=v elif o=='-D': debug=1 elif o=='-s': Z=0 try: from ZServer.medusa import asyncore sys.modules['asyncore']=asyncore except: pass if port is None and unix is None: print usage print 'No port specified.' sys.exit(1) if args: if len(args) > 1: print usage print 'Unrecognizd arguments: ', string.join(args[1:]) sys.exit(1) fs=args[0] __builtins__.__debug__=debug if debug: os.environ['Z_DEBUG_MODE']='1' from zLOG import LOG, INFO, ERROR # Try to set uid to "-u" -provided uid. # Try to set gid to "-u" user's primary group. # This will only work if this script is run by root. try: import pwd try: try: UID=string.atoi(UID) except: pass gid = None if type(UID) == type(""): uid = pwd.getpwnam(UID)[2] gid = pwd.getpwnam(UID)[3] elif type(UID) == type(1): uid = pwd.getpwuid(UID)[2] gid = pwd.getpwuid(UID)[3] else: raise KeyError try: if gid is not None: try: os.setgid(gid) except OSError: pass os.setuid(uid) except OSError: pass except KeyError: LOG('ZEO Server', ERROR, ("can't find UID %s" % UID)) except: pass if Z: try: import posix except: pass else: import zdaemon zdaemon.run(sys.argv, '') import ZEO.StorageServer, asyncore storages={} for o, v in opts: if o=='-S': n, m = string.split(v,'=') if string.find(m,':'): # we got an attribute name m, a = string.split(m,':') else: # attribute name must be same as storage name a=n storages[n]=get_storage(m,a) if not storages: import ZODB.FileStorage storages['1']=ZODB.FileStorage.FileStorage(fs) # Try to set up a signal handler try: import signal signal.signal(signal.SIGTERM, lambda sig, frame, s=storages: shutdown(s) ) signal.signal(signal.SIGINT, lambda sig, frame, s=storages: shutdown(s, 0) ) signal.signal(signal.SIGHUP, rotate_logs_handler) finally: pass items=storages.items() items.sort() for kv in items: LOG('ZEO Server', INFO, 'Serving %s:\t%s' % kv) if not unix: unix=host, port ZEO.StorageServer.StorageServer(unix, storages) open(zeo_pid,'w').write("%s %s" % (os.getppid(), os.getpid())) asyncore.loop()
|
394d2e4a344463769b2015545975694678298cf2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/394d2e4a344463769b2015545975694678298cf2/start.py
|
opts, args = getopt.getopt(args, 'p:Dh:U:sS:u:') fs=os.path.join(INSTANCE_HOME, 'var', 'Data.fs')
|
opts, args = getopt.getopt(args, 'p:Ddh:U:sS:u:') fs=os.path.join(var, 'Data.fs')
|
def main(argv): me=argv[0] sys.path[:]==filter(None, sys.path) sys.path.insert(0, directory(me, 2)) args=[] last='' for a in argv[1:]: if (a[:1] != '-' and string.find(a, '=') > 0 and last != '-S' # lame, sorry ): a=string.split(a,'=') os.environ[a[0]]=string.join(a[1:],'=') continue args.append(a) last=a INSTANCE_HOME=os.environ.get('INSTANCE_HOME', directory(me, 4)) zeo_pid=os.environ.get('ZEO_SERVER_PID', os.path.join(INSTANCE_HOME, 'var', 'ZEO_SERVER.pid') ) opts, args = getopt.getopt(args, 'p:Dh:U:sS:u:') fs=os.path.join(INSTANCE_HOME, 'var', 'Data.fs') usage="""%s [options] [filename] where options are: -D -- Run in debug mode -U -- Unix-domain socket file to listen on -u username or uid number The username to run the ZEO server as. You may want to run the ZEO server as 'nobody' or some other user with limited resouces. The only works under Unix, and if the storage server is started by root. -p port -- port to listen on -h adddress -- host address to listen on -s -- Don't use zdeamon -S storage_name=module_path:attr_name -- A storage specification where: storage_name -- is the storage name used in the ZEO protocol. This is the name that you give as the optional 'storage' keyword argument to the ClientStorage constructor. module_path -- This is the path to a Python module that defines the storage object(s) to be served. The module path should ommit the prefix (e.g. '.py'). attr_name -- This is the name to which the storage object is assigned in the module. if no file name is specified, then %s is used. """ % (me, fs) port=None debug=0 host='' unix=None Z=1 UID='nobody' for o, v in opts: if o=='-p': port=string.atoi(v) elif o=='-h': host=v elif o=='-U': unix=v elif o=='-u': UID=v elif o=='-D': debug=1 elif o=='-s': Z=0 try: from ZServer.medusa import asyncore sys.modules['asyncore']=asyncore except: pass if port is None and unix is None: print usage print 'No port specified.' sys.exit(1) if args: if len(args) > 1: print usage print 'Unrecognizd arguments: ', string.join(args[1:]) sys.exit(1) fs=args[0] __builtins__.__debug__=debug if debug: os.environ['Z_DEBUG_MODE']='1' from zLOG import LOG, INFO, ERROR # Try to set uid to "-u" -provided uid. # Try to set gid to "-u" user's primary group. # This will only work if this script is run by root. try: import pwd try: try: UID=string.atoi(UID) except: pass gid = None if type(UID) == type(""): uid = pwd.getpwnam(UID)[2] gid = pwd.getpwnam(UID)[3] elif type(UID) == type(1): uid = pwd.getpwuid(UID)[2] gid = pwd.getpwuid(UID)[3] else: raise KeyError try: if gid is not None: try: os.setgid(gid) except OSError: pass os.setuid(uid) except OSError: pass except KeyError: LOG('ZEO Server', ERROR, ("can't find UID %s" % UID)) except: pass if Z: try: import posix except: pass else: import zdaemon zdaemon.run(sys.argv, '') import ZEO.StorageServer, asyncore storages={} for o, v in opts: if o=='-S': n, m = string.split(v,'=') if string.find(m,':'): # we got an attribute name m, a = string.split(m,':') else: # attribute name must be same as storage name a=n storages[n]=get_storage(m,a) if not storages: import ZODB.FileStorage storages['1']=ZODB.FileStorage.FileStorage(fs) # Try to set up a signal handler try: import signal signal.signal(signal.SIGTERM, lambda sig, frame, s=storages: shutdown(s) ) signal.signal(signal.SIGINT, lambda sig, frame, s=storages: shutdown(s, 0) ) signal.signal(signal.SIGHUP, rotate_logs_handler) finally: pass items=storages.items() items.sort() for kv in items: LOG('ZEO Server', INFO, 'Serving %s:\t%s' % kv) if not unix: unix=host, port ZEO.StorageServer.StorageServer(unix, storages) open(zeo_pid,'w').write("%s %s" % (os.getppid(), os.getpid())) asyncore.loop()
|
394d2e4a344463769b2015545975694678298cf2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/394d2e4a344463769b2015545975694678298cf2/start.py
|
debug=0
|
debug=detailed=0
|
def main(argv): me=argv[0] sys.path[:]==filter(None, sys.path) sys.path.insert(0, directory(me, 2)) args=[] last='' for a in argv[1:]: if (a[:1] != '-' and string.find(a, '=') > 0 and last != '-S' # lame, sorry ): a=string.split(a,'=') os.environ[a[0]]=string.join(a[1:],'=') continue args.append(a) last=a INSTANCE_HOME=os.environ.get('INSTANCE_HOME', directory(me, 4)) zeo_pid=os.environ.get('ZEO_SERVER_PID', os.path.join(INSTANCE_HOME, 'var', 'ZEO_SERVER.pid') ) opts, args = getopt.getopt(args, 'p:Dh:U:sS:u:') fs=os.path.join(INSTANCE_HOME, 'var', 'Data.fs') usage="""%s [options] [filename] where options are: -D -- Run in debug mode -U -- Unix-domain socket file to listen on -u username or uid number The username to run the ZEO server as. You may want to run the ZEO server as 'nobody' or some other user with limited resouces. The only works under Unix, and if the storage server is started by root. -p port -- port to listen on -h adddress -- host address to listen on -s -- Don't use zdeamon -S storage_name=module_path:attr_name -- A storage specification where: storage_name -- is the storage name used in the ZEO protocol. This is the name that you give as the optional 'storage' keyword argument to the ClientStorage constructor. module_path -- This is the path to a Python module that defines the storage object(s) to be served. The module path should ommit the prefix (e.g. '.py'). attr_name -- This is the name to which the storage object is assigned in the module. if no file name is specified, then %s is used. """ % (me, fs) port=None debug=0 host='' unix=None Z=1 UID='nobody' for o, v in opts: if o=='-p': port=string.atoi(v) elif o=='-h': host=v elif o=='-U': unix=v elif o=='-u': UID=v elif o=='-D': debug=1 elif o=='-s': Z=0 try: from ZServer.medusa import asyncore sys.modules['asyncore']=asyncore except: pass if port is None and unix is None: print usage print 'No port specified.' sys.exit(1) if args: if len(args) > 1: print usage print 'Unrecognizd arguments: ', string.join(args[1:]) sys.exit(1) fs=args[0] __builtins__.__debug__=debug if debug: os.environ['Z_DEBUG_MODE']='1' from zLOG import LOG, INFO, ERROR # Try to set uid to "-u" -provided uid. # Try to set gid to "-u" user's primary group. # This will only work if this script is run by root. try: import pwd try: try: UID=string.atoi(UID) except: pass gid = None if type(UID) == type(""): uid = pwd.getpwnam(UID)[2] gid = pwd.getpwnam(UID)[3] elif type(UID) == type(1): uid = pwd.getpwuid(UID)[2] gid = pwd.getpwuid(UID)[3] else: raise KeyError try: if gid is not None: try: os.setgid(gid) except OSError: pass os.setuid(uid) except OSError: pass except KeyError: LOG('ZEO Server', ERROR, ("can't find UID %s" % UID)) except: pass if Z: try: import posix except: pass else: import zdaemon zdaemon.run(sys.argv, '') import ZEO.StorageServer, asyncore storages={} for o, v in opts: if o=='-S': n, m = string.split(v,'=') if string.find(m,':'): # we got an attribute name m, a = string.split(m,':') else: # attribute name must be same as storage name a=n storages[n]=get_storage(m,a) if not storages: import ZODB.FileStorage storages['1']=ZODB.FileStorage.FileStorage(fs) # Try to set up a signal handler try: import signal signal.signal(signal.SIGTERM, lambda sig, frame, s=storages: shutdown(s) ) signal.signal(signal.SIGINT, lambda sig, frame, s=storages: shutdown(s, 0) ) signal.signal(signal.SIGHUP, rotate_logs_handler) finally: pass items=storages.items() items.sort() for kv in items: LOG('ZEO Server', INFO, 'Serving %s:\t%s' % kv) if not unix: unix=host, port ZEO.StorageServer.StorageServer(unix, storages) open(zeo_pid,'w').write("%s %s" % (os.getppid(), os.getpid())) asyncore.loop()
|
394d2e4a344463769b2015545975694678298cf2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/394d2e4a344463769b2015545975694678298cf2/start.py
|
try: from ZServer.medusa import asyncore sys.modules['asyncore']=asyncore except: pass
|
import fap
|
def main(argv): me=argv[0] sys.path[:]==filter(None, sys.path) sys.path.insert(0, directory(me, 2)) args=[] last='' for a in argv[1:]: if (a[:1] != '-' and string.find(a, '=') > 0 and last != '-S' # lame, sorry ): a=string.split(a,'=') os.environ[a[0]]=string.join(a[1:],'=') continue args.append(a) last=a INSTANCE_HOME=os.environ.get('INSTANCE_HOME', directory(me, 4)) zeo_pid=os.environ.get('ZEO_SERVER_PID', os.path.join(INSTANCE_HOME, 'var', 'ZEO_SERVER.pid') ) opts, args = getopt.getopt(args, 'p:Dh:U:sS:u:') fs=os.path.join(INSTANCE_HOME, 'var', 'Data.fs') usage="""%s [options] [filename] where options are: -D -- Run in debug mode -U -- Unix-domain socket file to listen on -u username or uid number The username to run the ZEO server as. You may want to run the ZEO server as 'nobody' or some other user with limited resouces. The only works under Unix, and if the storage server is started by root. -p port -- port to listen on -h adddress -- host address to listen on -s -- Don't use zdeamon -S storage_name=module_path:attr_name -- A storage specification where: storage_name -- is the storage name used in the ZEO protocol. This is the name that you give as the optional 'storage' keyword argument to the ClientStorage constructor. module_path -- This is the path to a Python module that defines the storage object(s) to be served. The module path should ommit the prefix (e.g. '.py'). attr_name -- This is the name to which the storage object is assigned in the module. if no file name is specified, then %s is used. """ % (me, fs) port=None debug=0 host='' unix=None Z=1 UID='nobody' for o, v in opts: if o=='-p': port=string.atoi(v) elif o=='-h': host=v elif o=='-U': unix=v elif o=='-u': UID=v elif o=='-D': debug=1 elif o=='-s': Z=0 try: from ZServer.medusa import asyncore sys.modules['asyncore']=asyncore except: pass if port is None and unix is None: print usage print 'No port specified.' sys.exit(1) if args: if len(args) > 1: print usage print 'Unrecognizd arguments: ', string.join(args[1:]) sys.exit(1) fs=args[0] __builtins__.__debug__=debug if debug: os.environ['Z_DEBUG_MODE']='1' from zLOG import LOG, INFO, ERROR # Try to set uid to "-u" -provided uid. # Try to set gid to "-u" user's primary group. # This will only work if this script is run by root. try: import pwd try: try: UID=string.atoi(UID) except: pass gid = None if type(UID) == type(""): uid = pwd.getpwnam(UID)[2] gid = pwd.getpwnam(UID)[3] elif type(UID) == type(1): uid = pwd.getpwuid(UID)[2] gid = pwd.getpwuid(UID)[3] else: raise KeyError try: if gid is not None: try: os.setgid(gid) except OSError: pass os.setuid(uid) except OSError: pass except KeyError: LOG('ZEO Server', ERROR, ("can't find UID %s" % UID)) except: pass if Z: try: import posix except: pass else: import zdaemon zdaemon.run(sys.argv, '') import ZEO.StorageServer, asyncore storages={} for o, v in opts: if o=='-S': n, m = string.split(v,'=') if string.find(m,':'): # we got an attribute name m, a = string.split(m,':') else: # attribute name must be same as storage name a=n storages[n]=get_storage(m,a) if not storages: import ZODB.FileStorage storages['1']=ZODB.FileStorage.FileStorage(fs) # Try to set up a signal handler try: import signal signal.signal(signal.SIGTERM, lambda sig, frame, s=storages: shutdown(s) ) signal.signal(signal.SIGINT, lambda sig, frame, s=storages: shutdown(s, 0) ) signal.signal(signal.SIGHUP, rotate_logs_handler) finally: pass items=storages.items() items.sort() for kv in items: LOG('ZEO Server', INFO, 'Serving %s:\t%s' % kv) if not unix: unix=host, port ZEO.StorageServer.StorageServer(unix, storages) open(zeo_pid,'w').write("%s %s" % (os.getppid(), os.getpid())) asyncore.loop()
|
394d2e4a344463769b2015545975694678298cf2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/394d2e4a344463769b2015545975694678298cf2/start.py
|
__builtins__.__debug__=debug
|
def main(argv): me=argv[0] sys.path[:]==filter(None, sys.path) sys.path.insert(0, directory(me, 2)) args=[] last='' for a in argv[1:]: if (a[:1] != '-' and string.find(a, '=') > 0 and last != '-S' # lame, sorry ): a=string.split(a,'=') os.environ[a[0]]=string.join(a[1:],'=') continue args.append(a) last=a INSTANCE_HOME=os.environ.get('INSTANCE_HOME', directory(me, 4)) zeo_pid=os.environ.get('ZEO_SERVER_PID', os.path.join(INSTANCE_HOME, 'var', 'ZEO_SERVER.pid') ) opts, args = getopt.getopt(args, 'p:Dh:U:sS:u:') fs=os.path.join(INSTANCE_HOME, 'var', 'Data.fs') usage="""%s [options] [filename] where options are: -D -- Run in debug mode -U -- Unix-domain socket file to listen on -u username or uid number The username to run the ZEO server as. You may want to run the ZEO server as 'nobody' or some other user with limited resouces. The only works under Unix, and if the storage server is started by root. -p port -- port to listen on -h adddress -- host address to listen on -s -- Don't use zdeamon -S storage_name=module_path:attr_name -- A storage specification where: storage_name -- is the storage name used in the ZEO protocol. This is the name that you give as the optional 'storage' keyword argument to the ClientStorage constructor. module_path -- This is the path to a Python module that defines the storage object(s) to be served. The module path should ommit the prefix (e.g. '.py'). attr_name -- This is the name to which the storage object is assigned in the module. if no file name is specified, then %s is used. """ % (me, fs) port=None debug=0 host='' unix=None Z=1 UID='nobody' for o, v in opts: if o=='-p': port=string.atoi(v) elif o=='-h': host=v elif o=='-U': unix=v elif o=='-u': UID=v elif o=='-D': debug=1 elif o=='-s': Z=0 try: from ZServer.medusa import asyncore sys.modules['asyncore']=asyncore except: pass if port is None and unix is None: print usage print 'No port specified.' sys.exit(1) if args: if len(args) > 1: print usage print 'Unrecognizd arguments: ', string.join(args[1:]) sys.exit(1) fs=args[0] __builtins__.__debug__=debug if debug: os.environ['Z_DEBUG_MODE']='1' from zLOG import LOG, INFO, ERROR # Try to set uid to "-u" -provided uid. # Try to set gid to "-u" user's primary group. # This will only work if this script is run by root. try: import pwd try: try: UID=string.atoi(UID) except: pass gid = None if type(UID) == type(""): uid = pwd.getpwnam(UID)[2] gid = pwd.getpwnam(UID)[3] elif type(UID) == type(1): uid = pwd.getpwuid(UID)[2] gid = pwd.getpwuid(UID)[3] else: raise KeyError try: if gid is not None: try: os.setgid(gid) except OSError: pass os.setuid(uid) except OSError: pass except KeyError: LOG('ZEO Server', ERROR, ("can't find UID %s" % UID)) except: pass if Z: try: import posix except: pass else: import zdaemon zdaemon.run(sys.argv, '') import ZEO.StorageServer, asyncore storages={} for o, v in opts: if o=='-S': n, m = string.split(v,'=') if string.find(m,':'): # we got an attribute name m, a = string.split(m,':') else: # attribute name must be same as storage name a=n storages[n]=get_storage(m,a) if not storages: import ZODB.FileStorage storages['1']=ZODB.FileStorage.FileStorage(fs) # Try to set up a signal handler try: import signal signal.signal(signal.SIGTERM, lambda sig, frame, s=storages: shutdown(s) ) signal.signal(signal.SIGINT, lambda sig, frame, s=storages: shutdown(s, 0) ) signal.signal(signal.SIGHUP, rotate_logs_handler) finally: pass items=storages.items() items.sort() for kv in items: LOG('ZEO Server', INFO, 'Serving %s:\t%s' % kv) if not unix: unix=host, port ZEO.StorageServer.StorageServer(unix, storages) open(zeo_pid,'w').write("%s %s" % (os.getppid(), os.getpid())) asyncore.loop()
|
394d2e4a344463769b2015545975694678298cf2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/394d2e4a344463769b2015545975694678298cf2/start.py
|
|
import ZEO.StorageServer, asyncore storages={} for o, v in opts: if o=='-S': n, m = string.split(v,'=') if string.find(m,':'): m, a = string.split(m,':') else: a=n storages[n]=get_storage(m,a) if not storages: import ZODB.FileStorage storages['1']=ZODB.FileStorage.FileStorage(fs)
|
def main(argv): me=argv[0] sys.path[:]==filter(None, sys.path) sys.path.insert(0, directory(me, 2)) args=[] last='' for a in argv[1:]: if (a[:1] != '-' and string.find(a, '=') > 0 and last != '-S' # lame, sorry ): a=string.split(a,'=') os.environ[a[0]]=string.join(a[1:],'=') continue args.append(a) last=a INSTANCE_HOME=os.environ.get('INSTANCE_HOME', directory(me, 4)) zeo_pid=os.environ.get('ZEO_SERVER_PID', os.path.join(INSTANCE_HOME, 'var', 'ZEO_SERVER.pid') ) opts, args = getopt.getopt(args, 'p:Dh:U:sS:u:') fs=os.path.join(INSTANCE_HOME, 'var', 'Data.fs') usage="""%s [options] [filename] where options are: -D -- Run in debug mode -U -- Unix-domain socket file to listen on -u username or uid number The username to run the ZEO server as. You may want to run the ZEO server as 'nobody' or some other user with limited resouces. The only works under Unix, and if the storage server is started by root. -p port -- port to listen on -h adddress -- host address to listen on -s -- Don't use zdeamon -S storage_name=module_path:attr_name -- A storage specification where: storage_name -- is the storage name used in the ZEO protocol. This is the name that you give as the optional 'storage' keyword argument to the ClientStorage constructor. module_path -- This is the path to a Python module that defines the storage object(s) to be served. The module path should ommit the prefix (e.g. '.py'). attr_name -- This is the name to which the storage object is assigned in the module. if no file name is specified, then %s is used. """ % (me, fs) port=None debug=0 host='' unix=None Z=1 UID='nobody' for o, v in opts: if o=='-p': port=string.atoi(v) elif o=='-h': host=v elif o=='-U': unix=v elif o=='-u': UID=v elif o=='-D': debug=1 elif o=='-s': Z=0 try: from ZServer.medusa import asyncore sys.modules['asyncore']=asyncore except: pass if port is None and unix is None: print usage print 'No port specified.' sys.exit(1) if args: if len(args) > 1: print usage print 'Unrecognizd arguments: ', string.join(args[1:]) sys.exit(1) fs=args[0] __builtins__.__debug__=debug if debug: os.environ['Z_DEBUG_MODE']='1' from zLOG import LOG, INFO, ERROR # Try to set uid to "-u" -provided uid. # Try to set gid to "-u" user's primary group. # This will only work if this script is run by root. try: import pwd try: try: UID=string.atoi(UID) except: pass gid = None if type(UID) == type(""): uid = pwd.getpwnam(UID)[2] gid = pwd.getpwnam(UID)[3] elif type(UID) == type(1): uid = pwd.getpwuid(UID)[2] gid = pwd.getpwuid(UID)[3] else: raise KeyError try: if gid is not None: try: os.setgid(gid) except OSError: pass os.setuid(uid) except OSError: pass except KeyError: LOG('ZEO Server', ERROR, ("can't find UID %s" % UID)) except: pass if Z: try: import posix except: pass else: import zdaemon zdaemon.run(sys.argv, '') import ZEO.StorageServer, asyncore storages={} for o, v in opts: if o=='-S': n, m = string.split(v,'=') if string.find(m,':'): # we got an attribute name m, a = string.split(m,':') else: # attribute name must be same as storage name a=n storages[n]=get_storage(m,a) if not storages: import ZODB.FileStorage storages['1']=ZODB.FileStorage.FileStorage(fs) # Try to set up a signal handler try: import signal signal.signal(signal.SIGTERM, lambda sig, frame, s=storages: shutdown(s) ) signal.signal(signal.SIGINT, lambda sig, frame, s=storages: shutdown(s, 0) ) signal.signal(signal.SIGHUP, rotate_logs_handler) finally: pass items=storages.items() items.sort() for kv in items: LOG('ZEO Server', INFO, 'Serving %s:\t%s' % kv) if not unix: unix=host, port ZEO.StorageServer.StorageServer(unix, storages) open(zeo_pid,'w').write("%s %s" % (os.getppid(), os.getpid())) asyncore.loop()
|
394d2e4a344463769b2015545975694678298cf2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/394d2e4a344463769b2015545975694678298cf2/start.py
|
|
import signal signal.signal(signal.SIGTERM, lambda sig, frame, s=storages: shutdown(s) ) signal.signal(signal.SIGINT, lambda sig, frame, s=storages: shutdown(s, 0) ) signal.signal(signal.SIGHUP, rotate_logs_handler) finally: pass items=storages.items() items.sort() for kv in items: LOG('ZEO Server', INFO, 'Serving %s:\t%s' % kv) if not unix: unix=host, port ZEO.StorageServer.StorageServer(unix, storages) open(zeo_pid,'w').write("%s %s" % (os.getppid(), os.getpid())) asyncore.loop()
|
import ZEO.StorageServer, asyncore storages={} for o, v in opts: if o=='-S': n, m = string.split(v,'=') if string.find(m,':'): m, a = string.split(m,':') else: a=n storages[n]=get_storage(m,a) if not storages: import ZODB.FileStorage storages['1']=ZODB.FileStorage.FileStorage(fs) try: import signal signal.signal(signal.SIGTERM, lambda sig, frame, s=storages: shutdown(s) ) signal.signal(signal.SIGINT, lambda sig, frame, s=storages: shutdown(s, 0) ) signal.signal(signal.SIGHUP, rotate_logs_handler) finally: pass items=storages.items() items.sort() for kv in items: LOG('ZEO Server', INFO, 'Serving %s:\t%s' % kv) if not unix: unix=host, port ZEO.StorageServer.StorageServer(unix, storages) open(zeo_pid,'w').write("%s %s" % (os.getppid(), os.getpid())) asyncore.loop() except: info=sys.exc_info() try: import zLOG zLOG.LOG("z2", zLOG.PANIC, "Startup exception", error=info) except: info2=sys.exc_info() import traceback traceback.print_exception(*info) traceback.print_exception(*info2) sys.exit(0)
|
def main(argv): me=argv[0] sys.path[:]==filter(None, sys.path) sys.path.insert(0, directory(me, 2)) args=[] last='' for a in argv[1:]: if (a[:1] != '-' and string.find(a, '=') > 0 and last != '-S' # lame, sorry ): a=string.split(a,'=') os.environ[a[0]]=string.join(a[1:],'=') continue args.append(a) last=a INSTANCE_HOME=os.environ.get('INSTANCE_HOME', directory(me, 4)) zeo_pid=os.environ.get('ZEO_SERVER_PID', os.path.join(INSTANCE_HOME, 'var', 'ZEO_SERVER.pid') ) opts, args = getopt.getopt(args, 'p:Dh:U:sS:u:') fs=os.path.join(INSTANCE_HOME, 'var', 'Data.fs') usage="""%s [options] [filename] where options are: -D -- Run in debug mode -U -- Unix-domain socket file to listen on -u username or uid number The username to run the ZEO server as. You may want to run the ZEO server as 'nobody' or some other user with limited resouces. The only works under Unix, and if the storage server is started by root. -p port -- port to listen on -h adddress -- host address to listen on -s -- Don't use zdeamon -S storage_name=module_path:attr_name -- A storage specification where: storage_name -- is the storage name used in the ZEO protocol. This is the name that you give as the optional 'storage' keyword argument to the ClientStorage constructor. module_path -- This is the path to a Python module that defines the storage object(s) to be served. The module path should ommit the prefix (e.g. '.py'). attr_name -- This is the name to which the storage object is assigned in the module. if no file name is specified, then %s is used. """ % (me, fs) port=None debug=0 host='' unix=None Z=1 UID='nobody' for o, v in opts: if o=='-p': port=string.atoi(v) elif o=='-h': host=v elif o=='-U': unix=v elif o=='-u': UID=v elif o=='-D': debug=1 elif o=='-s': Z=0 try: from ZServer.medusa import asyncore sys.modules['asyncore']=asyncore except: pass if port is None and unix is None: print usage print 'No port specified.' sys.exit(1) if args: if len(args) > 1: print usage print 'Unrecognizd arguments: ', string.join(args[1:]) sys.exit(1) fs=args[0] __builtins__.__debug__=debug if debug: os.environ['Z_DEBUG_MODE']='1' from zLOG import LOG, INFO, ERROR # Try to set uid to "-u" -provided uid. # Try to set gid to "-u" user's primary group. # This will only work if this script is run by root. try: import pwd try: try: UID=string.atoi(UID) except: pass gid = None if type(UID) == type(""): uid = pwd.getpwnam(UID)[2] gid = pwd.getpwnam(UID)[3] elif type(UID) == type(1): uid = pwd.getpwuid(UID)[2] gid = pwd.getpwuid(UID)[3] else: raise KeyError try: if gid is not None: try: os.setgid(gid) except OSError: pass os.setuid(uid) except OSError: pass except KeyError: LOG('ZEO Server', ERROR, ("can't find UID %s" % UID)) except: pass if Z: try: import posix except: pass else: import zdaemon zdaemon.run(sys.argv, '') import ZEO.StorageServer, asyncore storages={} for o, v in opts: if o=='-S': n, m = string.split(v,'=') if string.find(m,':'): # we got an attribute name m, a = string.split(m,':') else: # attribute name must be same as storage name a=n storages[n]=get_storage(m,a) if not storages: import ZODB.FileStorage storages['1']=ZODB.FileStorage.FileStorage(fs) # Try to set up a signal handler try: import signal signal.signal(signal.SIGTERM, lambda sig, frame, s=storages: shutdown(s) ) signal.signal(signal.SIGINT, lambda sig, frame, s=storages: shutdown(s, 0) ) signal.signal(signal.SIGHUP, rotate_logs_handler) finally: pass items=storages.items() items.sort() for kv in items: LOG('ZEO Server', INFO, 'Serving %s:\t%s' % kv) if not unix: unix=host, port ZEO.StorageServer.StorageServer(unix, storages) open(zeo_pid,'w').write("%s %s" % (os.getppid(), os.getpid())) asyncore.loop()
|
394d2e4a344463769b2015545975694678298cf2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/394d2e4a344463769b2015545975694678298cf2/start.py
|
self.storage._log("store error: %s, %s" % exc_info[:2], zLOG.ERROR, error=exc_info)
|
log("store error: %s, %s" % exc_info[:2], zLOG.ERROR, error=exc_info)
|
def store(self, oid, serial, data, version): try: newserial = self.storage.store(oid, serial, data, version, self.txn) except TransactionError, err: # Storage errors are passed to the client newserial = err except Exception: # Unexpected storage errors are logged and passed to the client exc_info = sys.exc_info() self.storage._log("store error: %s, %s" % exc_info[:2], zLOG.ERROR, error=exc_info) newserial = exc_info[1] del exc_info else: if serial != "\0\0\0\0\0\0\0\0": self.invalidated.append((oid, version))
|
3366502b09a2c607316c80421c66d2ebc4026c22 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/3366502b09a2c607316c80421c66d2ebc4026c22/StorageServer.py
|
self.storage._log(msg, zLOG.ERROR)
|
log(msg, zLOG.ERROR)
|
def store(self, oid, serial, data, version): try: newserial = self.storage.store(oid, serial, data, version, self.txn) except TransactionError, err: # Storage errors are passed to the client newserial = err except Exception: # Unexpected storage errors are logged and passed to the client exc_info = sys.exc_info() self.storage._log("store error: %s, %s" % exc_info[:2], zLOG.ERROR, error=exc_info) newserial = exc_info[1] del exc_info else: if serial != "\0\0\0\0\0\0\0\0": self.invalidated.append((oid, version))
|
3366502b09a2c607316c80421c66d2ebc4026c22 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/3366502b09a2c607316c80421c66d2ebc4026c22/StorageServer.py
|
success = self.try_connecting()
|
success = self.try_connecting(attempt_timeout)
|
def run(self): delay = self.tmin success = 0 while not self.stopped: success = self.try_connecting() if not self.one_attempt.isSet(): self.one_attempt.set() if success > 0: break time.sleep(delay) delay = min(delay*2, self.tmax) log("CT: exiting thread: %s" % self.getName())
|
353aeeac980bd27a7a227b1ce012b2f7b49ce0a6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/353aeeac980bd27a7a227b1ce012b2f7b49ce0a6/client.py
|
def try_connecting(self):
|
def try_connecting(self, timeout):
|
def try_connecting(self): """Try connecting to all self.addrlist addresses.
|
353aeeac980bd27a7a227b1ce012b2f7b49ce0a6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/353aeeac980bd27a7a227b1ce012b2f7b49ce0a6/client.py
|
def try_connecting(self): """Try connecting to all self.addrlist addresses.
|
353aeeac980bd27a7a227b1ce012b2f7b49ce0a6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/353aeeac980bd27a7a227b1ce012b2f7b49ce0a6/client.py
|
||
deadline = time.time() + timeout wrappers = self._create_wrappers() for wrap in wrappers.keys(): if wrap.state == "notified": return 1 try: if time.time() > deadline: return 0 r = self._connect_wrappers(wrappers, deadline) if r is not None: return r if time.time() > deadline: return 0 r = self._fallback_wrappers(wrappers, deadline) if r is not None: return r assert not wrappers finally: for wrap in wrappers.keys(): wrap.close() del wrappers return 0 def _create_wrappers(self):
|
def try_connecting(self): """Try connecting to all self.addrlist addresses.
|
353aeeac980bd27a7a227b1ce012b2f7b49ce0a6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/353aeeac980bd27a7a227b1ce012b2f7b49ce0a6/client.py
|
|
return 1
|
wrappers[wrap] = wrap return wrappers
|
def try_connecting(self): """Try connecting to all self.addrlist addresses.
|
353aeeac980bd27a7a227b1ce012b2f7b49ce0a6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/353aeeac980bd27a7a227b1ce012b2f7b49ce0a6/client.py
|
return wrappers def _connect_wrappers(self, wrappers, deadline):
|
def try_connecting(self): """Try connecting to all self.addrlist addresses.
|
353aeeac980bd27a7a227b1ce012b2f7b49ce0a6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/353aeeac980bd27a7a227b1ce012b2f7b49ce0a6/client.py
|
|
def try_connecting(self): """Try connecting to all self.addrlist addresses.
|
353aeeac980bd27a7a227b1ce012b2f7b49ce0a6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/353aeeac980bd27a7a227b1ce012b2f7b49ce0a6/client.py
|
||
assert not wrappers return 0
|
def try_connecting(self): """Try connecting to all self.addrlist addresses.
|
353aeeac980bd27a7a227b1ce012b2f7b49ce0a6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/353aeeac980bd27a7a227b1ce012b2f7b49ce0a6/client.py
|
|
self.handleError()
|
self.handleError(record)
|
def emit(self, record): try: self.buffer.append(record) msg = self.format(record) self.stream.write("%s\n" % msg) self.flush() except: self.handleError()
|
7d4f82a4dc4e183226a103bb2ff7e318d63ba0bf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/7d4f82a4dc4e183226a103bb2ff7e318d63ba0bf/LogHandlers.py
|
def tryToResolveConflict(self, oid, committedSerial, oldSerial, newpickle, committedData=''): #class_tuple, old, committed, newstate = ('',''), 0, 0, 0 try: file = StringIO(newpickle) unpickler = Unpickler(file) prfactory = PersistentReferenceFactory() unpickler.persistent_load = prfactory.persistent_load class_tuple = unpickler.load()[0] if bad_class(class_tuple): return 0 newstate = unpickler.load() klass = _classFactory(class_tuple[0], class_tuple[1]) inst = klass.__basicnew__() try: resolve = inst._p_resolveConflict except AttributeError: bad_classes[class_tuple] = 1 return 0 old = state(self, oid, oldSerial, prfactory) committed = state(self, oid, committedSerial, prfactory, committedData) resolved = resolve(old, committed, newstate) file = StringIO() pickler = Pickler(file,1) pickler.persistent_id = persistent_id pickler.dump(class_tuple) pickler.dump(resolved) return file.getvalue(1) except ConflictError: return 0
|
ddd1218d624c67196fc6ddce8b470b8e6ac66f8a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/ddd1218d624c67196fc6ddce8b470b8e6ac66f8a/ConflictResolution.py
|
||
prfactory = PersistentReferenceFactory()
|
def tryToResolveConflict(self, oid, committedSerial, oldSerial, newpickle, committedData=''): #class_tuple, old, committed, newstate = ('',''), 0, 0, 0 try: file = StringIO(newpickle) unpickler = Unpickler(file) prfactory = PersistentReferenceFactory() unpickler.persistent_load = prfactory.persistent_load class_tuple = unpickler.load()[0] if bad_class(class_tuple): return 0 newstate = unpickler.load() klass = _classFactory(class_tuple[0], class_tuple[1]) inst = klass.__basicnew__() try: resolve = inst._p_resolveConflict except AttributeError: bad_classes[class_tuple] = 1 return 0 old = state(self, oid, oldSerial, prfactory) committed = state(self, oid, committedSerial, prfactory, committedData) resolved = resolve(old, committed, newstate) file = StringIO() pickler = Pickler(file,1) pickler.persistent_id = persistent_id pickler.dump(class_tuple) pickler.dump(resolved) return file.getvalue(1) except ConflictError: return 0
|
ddd1218d624c67196fc6ddce8b470b8e6ac66f8a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/ddd1218d624c67196fc6ddce8b470b8e6ac66f8a/ConflictResolution.py
|
|
def tryToResolveConflict(self, oid, committedSerial, oldSerial, newpickle, committedData=''): #class_tuple, old, committed, newstate = ('',''), 0, 0, 0 try: file = StringIO(newpickle) unpickler = Unpickler(file) prfactory = PersistentReferenceFactory() unpickler.persistent_load = prfactory.persistent_load class_tuple = unpickler.load()[0] if bad_class(class_tuple): return 0 newstate = unpickler.load() klass = _classFactory(class_tuple[0], class_tuple[1]) inst = klass.__basicnew__() try: resolve = inst._p_resolveConflict except AttributeError: bad_classes[class_tuple] = 1 return 0 old = state(self, oid, oldSerial, prfactory) committed = state(self, oid, committedSerial, prfactory, committedData) resolved = resolve(old, committed, newstate) file = StringIO() pickler = Pickler(file,1) pickler.persistent_id = persistent_id pickler.dump(class_tuple) pickler.dump(resolved) return file.getvalue(1) except ConflictError: return 0
|
ddd1218d624c67196fc6ddce8b470b8e6ac66f8a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/ddd1218d624c67196fc6ddce8b470b8e6ac66f8a/ConflictResolution.py
|
||
klass = _classFactory(class_tuple[0], class_tuple[1])
|
klass = load_class(class_tuple)
|
def tryToResolveConflict(self, oid, committedSerial, oldSerial, newpickle, committedData=''): #class_tuple, old, committed, newstate = ('',''), 0, 0, 0 try: file = StringIO(newpickle) unpickler = Unpickler(file) prfactory = PersistentReferenceFactory() unpickler.persistent_load = prfactory.persistent_load class_tuple = unpickler.load()[0] if bad_class(class_tuple): return 0 newstate = unpickler.load() klass = _classFactory(class_tuple[0], class_tuple[1]) inst = klass.__basicnew__() try: resolve = inst._p_resolveConflict except AttributeError: bad_classes[class_tuple] = 1 return 0 old = state(self, oid, oldSerial, prfactory) committed = state(self, oid, committedSerial, prfactory, committedData) resolved = resolve(old, committed, newstate) file = StringIO() pickler = Pickler(file,1) pickler.persistent_id = persistent_id pickler.dump(class_tuple) pickler.dump(resolved) return file.getvalue(1) except ConflictError: return 0
|
ddd1218d624c67196fc6ddce8b470b8e6ac66f8a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/ddd1218d624c67196fc6ddce8b470b8e6ac66f8a/ConflictResolution.py
|
def testExceptionInTpcFinish(self): for sub in self.sub1, self.sub2: sub._p_jar = SubTransactionJar(errors='tpc_finish') sub.modify(nojar=1) self.nosub1.modify() try: get_transaction().commit() except TestTxnException: pass except Transaction.POSException.TransactionError: pass assert Transaction.hosed == 1 Transaction.hosed = 0
|
def testExceptionInTpcFinish(self):
|
16b081c875873c122c85de967c55b72ebc57ffee /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/16b081c875873c122c85de967c55b72ebc57ffee/testTransaction.py
|
|
def BUGtestExceptionInSubTpcBegin(self): """ bug, we short circuit on notifying objects in previous subtransactions of the transaction outcome untested but this probably also applies to error in tpc_finish, as the error has to do with not checking the implicit sub transaction commit done when closing the outer transaction. trace: nosub1 calling method tpc_begin sub2 calling method tpc_begin sub2 calling method commit nosub1 calling method tpc_finish sub2 calling method tpc_finish sub3 calling method tpc_begin sub3 calling method commit sub1 calling method tpc_begin sub1 calling method abort sub1 calling method tpc_abort sub3 calling method tpc_abort """ self.nosub1.modify(tracing='nosub1') self.sub2._p_jar = SubTransactionJar(tracing='sub2') self.sub2.modify(nojar=1) get_transaction().commit(1) self.sub3.modify(tracing='sub3') self.sub1._p_jar = SubTransactionJar(tracing='sub1', errors='tpc_begin') self.sub1.modify(nojar=1) try: get_transaction().commit() except TestTxnException: pass
|
def testExceptionInSubAbortSub(self): self.sub1._p_jar = SubTransactionJar(errors='commit_sub') self.sub1.modify(nojar=1) get_transaction().commit(1)
|
16b081c875873c122c85de967c55b72ebc57ffee /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/16b081c875873c122c85de967c55b72ebc57ffee/testTransaction.py
|
|
for sub in self.sub1, self.sub2: sub._p_jar = SubTransactionJar(errors='tpc_finish') sub.modify(nojar=1) self.nosub1.modify() try: get_transaction().commit() except TestTxnException: pass assert Transaction.hosed == 1
|
objects = self.sub1, self.sub2, self.sub3, self.nosub1 for i in range(10): L = list(objects) random.shuffle(L) obj = L.pop() obj.modify() obj2 = L.pop() obj2._p_jar = SubTransactionJar(errors='tpc_finish') obj2.modify(nojar=1) try: get_transaction().commit() except TestTxnException: pass jars = {} for obj in objects: jar = obj._p_jar if jar is not None: jars[jar] = 1 jars = jars.keys() succeed = 0 fail = 0 for jar in jars: if jar.ctpc_finish: succeed += 1 elif jar.ctpc_abort: fail += 1 if Transaction.hosed: self.assert_(fail > 0 and succeed > 0) break else: self.assert_(fail and not succeed), get_transaction().abort() self.setUp() else: self.fail("Couldn't provoke hosed state.")
|
def testHoserStoppage(self): # must have errors in at least two jars to guarantee a failure for sub in self.sub1, self.sub2: sub._p_jar = SubTransactionJar(errors='tpc_finish') sub.modify(nojar=1) self.nosub1.modify()
|
16b081c875873c122c85de967c55b72ebc57ffee /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/16b081c875873c122c85de967c55b72ebc57ffee/testTransaction.py
|
def deprecated_loop(*args, **kws): import warnings warnings.warn("""\ ThreadedAsync.loop() called through sneaky asyncore.loop() rebinding. You should change your code to call ThreadedAsync.loop() explicitly.""", DeprecationWarning) loop(*args, **kws)
|
def deprecated_loop(*args, **kws): import warnings warnings.warn("""\
|
d9741d146d13798860449198ed62b2b825876af0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/d9741d146d13798860449198ed62b2b825876af0/LoopCallback.py
|
|
asyncore.loop = deprecated_loop
|
asyncore.loop = loop
|
def deprecated_loop(*args, **kws): import warnings warnings.warn("""\
|
d9741d146d13798860449198ed62b2b825876af0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/d9741d146d13798860449198ed62b2b825876af0/LoopCallback.py
|
print >> _log_dest, "s: %s" % error[:2]
|
print >> _log_dest, "%s: %s" % error[:2]
|
def log(self, subsystem, severity, summary, detail, error): if _log_dest is None or severity < _log_level: return
|
64396daba316f3a1fa42570dc18b8373801ce3a4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/64396daba316f3a1fa42570dc18b8373801ce3a4/MinimalLogger.py
|
elif o=='-M':
|
elif o=='-L':
|
def main(args): opts, args = getopt.getopt(args, 'zd:n:Ds:L') z=s=None data=sys.argv[0] nrep=5 minimize=0 for o, v in opts: if o=='-n': nrep=string.atoi(v) elif o=='-d': data=v elif o=='-s': s=v elif o=='-z': global zlib import zlib z=compress elif o=='-M': minimize=1 elif o=='-D': global debug os.environ['STUPID_LOG_FILE']='' os.environ['STUPID_LOG_SEVERITY']='-999' __builtins__.__debug__=1 if s: s=__import__(s, globals(), globals(), ('__doc__',)) s=s.Storage else: s=ZODB.FileStorage.FileStorage('zeo_speed.fs', create=1) data=open(data).read() db=ZODB.DB(s, # disable cache deactivation cache_size=4000, cache_deactivate_after=6000,) results={} for j in range(nrep): for r in 1, 10, 100, 1000: t=time.time() jar=db.open() get_transaction().begin() rt=jar.root() key='s%s' % r if rt.has_key(key): p=rt[key] else: rt[key]=p=P() for i in range(r): if z is not None: d=z(data) else: d=data v=getattr(p, str(i), P()) v.d=d setattr(p,str(i),v) get_transaction().commit() jar.close() sys.stderr.write("%s %s %s\n" % (j, r, time.time()-t)) sys.stdout.flush() rt=d=p=v=None # release all references if minimize: time.sleep(3) jar.cacheMinimize(3)
|
9e0adc6d7e03dfaf27793723c7e346670cce10b8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/9e0adc6d7e03dfaf27793723c7e346670cce10b8/speed.py
|
if not (self._mvcc and self._setstate_noncurrent(obj)): self.getTransaction().register(obj) self._conflicts[obj._p_oid] = 1 raise ReadConflictError(object=obj)
|
self._load_before_or_conflict(obj) return
|
def _setstate(self, obj): # Helper for setstate(), which provides logging of failures.
|
f673079bfe822e4f9812a8b873a40cbafda945ef /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/f673079bfe822e4f9812a8b873a40cbafda945ef/Connection.py
|
elif not (self._mvcc and self._setstate_noncurrent(obj)): self.getTransaction().register(obj) self._conflicts[obj._p_oid] = 1 raise ReadConflictError(object=obj)
|
else: self._load_before_or_conflict(obj) return
|
def _setstate(self, obj): # Helper for setstate(), which provides logging of failures.
|
f673079bfe822e4f9812a8b873a40cbafda945ef /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/f673079bfe822e4f9812a8b873a40cbafda945ef/Connection.py
|
os.path.join(here, "releases", "ZODB3", "PUBLICATION.cfg"))
|
os.path.join(here, "PUBLICATION.cfg"))
|
def join(*parts): local_full_path = os.path.join(here, *parts) relative_path = posixpath.join(*parts) return local_full_path, relative_path
|
e745a089a0e52a0aae220e38eabe4d68d279a9c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/e745a089a0e52a0aae220e38eabe4d68d279a9c1/setup.py
|
context.scan("ZODB3", *join("releases", "ZODB3"))
|
context.scan("ZODB3", here, ".")
|
def join(*parts): local_full_path = os.path.join(here, *parts) relative_path = posixpath.join(*parts) return local_full_path, relative_path
|
e745a089a0e52a0aae220e38eabe4d68d279a9c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/e745a089a0e52a0aae220e38eabe4d68d279a9c1/setup.py
|
if os.name == "nt":
|
def get_port(): """Return a port that is not in use. Checks if a port is in use by trying to connect to it. Assumes it is not in use if connect raises an exception. Raises RuntimeError after 10 tries. """ for i in range(10): port = random.randrange(20000, 30000) s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: try: s.connect(('localhost', port)) except socket.error: # XXX check value of error? return port finally: s.close() raise RuntimeError, "Can't find port"
|
bc0fdca4bd5c0411686eec40f2159d705c679ffa /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/bc0fdca4bd5c0411686eec40f2159d705c679ffa/forker.py
|
|
def start_zeo_server(conf, addr=None, ro_svr=0): """Start a ZEO server in a separate process.
|
def start_zeo_server(conf, addr=None, ro_svr=0): """Start a ZEO server in a separate process.
|
def get_port(): """Return a port that is not in use. Checks if a port is in use by trying to connect to it. Assumes it is not in use if connect raises an exception. Raises RuntimeError after 10 tries. """ for i in range(10): port = random.randrange(20000, 30000) s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: try: s.connect(('localhost', port)) except socket.error: # XXX check value of error? return port finally: s.close() raise RuntimeError, "Can't find port"
|
bc0fdca4bd5c0411686eec40f2159d705c679ffa /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/bc0fdca4bd5c0411686eec40f2159d705c679ffa/forker.py
|
Returns the ZEO port, the test server port, and the pid. """ import ZEO.tests.winserver if addr is None: port = get_port() else: port = addr[1] script = ZEO.tests.winserver.__file__ if script.endswith('.pyc'): script = script[:-1] if ro_svr: prefix = (sys.executable, script, "-r") else: prefix = (sys.executable, script) args = prefix + (str(port), storage_name) + args d = os.environ.copy() d['PYTHONPATH'] = os.pathsep.join(sys.path) pid = os.spawnve(os.P_NOWAIT, sys.executable, args, d) return ('localhost', port), ('localhost', port + 1), pid
|
Returns the ZEO port, the test server port, and the pid. """ tmpfile = tempfile.mktemp() fp = open(tmpfile, 'w') fp.write(conf) fp.close() import ZEO.tests.zeoserver if addr is None: port = get_port() else: port = addr[1] script = ZEO.tests.zeoserver.__file__ if script.endswith('.pyc'): script = script[:-1] args = [sys.executable, script, '-C', tmpfile] if ro_svr: args.append('-r') args.append(str(port)) d = os.environ.copy() d['PYTHONPATH'] = os.pathsep.join(sys.path) pid = os.spawnve(os.P_NOWAIT, sys.executable, tuple(args), d) adminaddr = ('localhost', port+1) s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) for i in range(5): try: zLOG.LOG('forker', zLOG.DEBUG, 'connect %s' % i) s.connect(adminaddr) ack = s.recv(1) zLOG.LOG('forker', zLOG.DEBUG, 'acked: %s' % ack) break except socket.error, e: if e[0] <> errno.ECONNREFUSED: raise time.sleep(1) else: zLOG.LOG('forker', zLOG.DEBUG, 'boo hoo') raise return ('localhost', port), adminaddr, pid
|
def start_zeo_server(conf, addr=None, ro_svr=0): """Start a ZEO server in a separate process.
|
bc0fdca4bd5c0411686eec40f2159d705c679ffa /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/bc0fdca4bd5c0411686eec40f2159d705c679ffa/forker.py
|
else:
|
def start_zeo_server(conf, addr=None, ro_svr=0): """Start a ZEO server in a separate process.
|
bc0fdca4bd5c0411686eec40f2159d705c679ffa /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/bc0fdca4bd5c0411686eec40f2159d705c679ffa/forker.py
|
|
class ZEOServerExit(asyncore.file_dispatcher): """Used to exit ZEO.StorageServer when run is done""" def writable(self): return 0 def readable(self): return 1 def handle_read(self): buf = self.recv(4) if buf: assert buf == "done" server.close_server() asyncore.socket_map.clear() def handle_close(self): server.close_server() asyncore.socket_map.clear() class ZEOClientExit: """Used by client to cause server to exit""" def __init__(self, pipe): self.pipe = pipe def close(self): try: os.write(self.pipe, "done") os.close(self.pipe) except os.error: pass def start_zeo_server(conf, addr, ro_svr=0): rd, wr = os.pipe() pid = os.fork() if pid == 0: asyncore.socket_map.clear() import ZEO.zrpc.log reload(ZEO.zrpc.log) try: if PROFILE: p = hotshot.Profile("stats.s.%d" % os.getpid()) p.runctx( "run_server(addr, rd, wr, conf, ro_svr)", globals(), locals()) p.close() else: run_server(addr, rd, wr, conf, ro_svr) except: print "Exception in ZEO server process" traceback.print_exc() os._exit(0) else: os.close(rd) return pid, ZEOClientExit(wr) def load_storage(conf): fp = StringIO(conf) rootconf = ZConfig.loadfile(fp) storageconf = rootconf.getSection('Storage') return StorageConfig.createStorage(storageconf) def run_server(addr, rd, wr, conf, ro_svr): global server os.close(wr) ZEOServerExit(rd) import ZEO.StorageServer, ZEO.zrpc.server storage = load_storage(conf) server = ZEO.StorageServer.StorageServer(addr, {'1':storage}, ro_svr) ZEO.zrpc.server.loop() storage.close() if isinstance(addr, types.StringType): os.unlink(addr) def start_zeo(conf, cache=None, cleanup=None, domain="AF_INET", storage_id="1", cache_size=20000000): """Setup ZEO client-server for storage. Returns a ClientStorage instance and a ZEOClientExit instance. XXX Don't know if os.pipe() will work on Windows. """ if domain == "AF_INET": addr = '', get_port() elif domain == "AF_UNIX": import tempfile addr = tempfile.mktemp() else: raise ValueError, "bad domain: %s" % domain pid, exit = start_zeo_server(conf, addr) s = ZEO.ClientStorage.ClientStorage(addr, storage_id, client=cache, cache_size=cache_size, min_disconnect_poll=0.5, wait=1) return s, exit, pid
|
def shutdown_zeo_server(adminaddr): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(adminaddr) ack = s.recv(1) zLOG.LOG('shutdownServer', zLOG.DEBUG, 'acked: %s' % ack) s.close()
|
def start_zeo_server(conf, addr=None, ro_svr=0): """Start a ZEO server in a separate process.
|
bc0fdca4bd5c0411686eec40f2159d705c679ffa /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/bc0fdca4bd5c0411686eec40f2159d705c679ffa/forker.py
|
def filter(desc, spec=specification.items()): get=desc.get for k, v in spec: if get(k, None) != v: return 0 return 1
|
if specification: def filter(desc, spec=specification.items()): get=desc.get for k, v in spec: if get(k, None) != v: return 0 return 1 else: filter=None
|
def filter(desc, spec=specification.items()): get=desc.get for k, v in spec: if get(k, None) != v: return 0 return 1
|
3944f2115c14a001cbcdde2f76abfe66b09fba80 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/3944f2115c14a001cbcdde2f76abfe66b09fba80/UndoLogCompatible.py
|
SizedMessageAsyncConnection.__init__(self, s, s.getpeername(), {})
|
SizedMessageAsyncConnection.__init__(self, s, '', {})
|
def finishConnect(self, s): SizedMessageAsyncConnection.__init__(self, s, s.getpeername(), {})
|
0af8720b92ed012c2811325769d595dcdd53cb05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/0af8720b92ed012c2811325769d595dcdd53cb05/zrpc.py
|
args=dump(args,1) self.message_output(args) if self.__map: self.__Wakeup() else: self.readLoop() while 1: r=self._read() c=r[:1] if c=='R': if r=='RN.': return None return loads(r[1:]) if c=='E': r=loads(r[1:]) if type(r) is TupleType: raise r[0], r[1] raise r oob=self._outOfBand if oob is not None: r=r[1:] if r=='N.': r=None else: r=loads(r) oob(c, r) else: raise UnrecognizedResult, r
|
self.__call_la() try: self._last_args=args=dump(args,1) self.message_output(args) if self.__map: self.__Wakeup() else: self.readLoop() while 1: r=self._read() c=r[:1] if c=='R': if r=='RN.': return None return loads(r[1:]) if c=='E': try: r=loads(r[1:]) except: raise UnUnPickleableError(r[1:]) if type(r) is TupleType: raise r[0], r[1] raise r oob=self._outOfBand if oob is not None: r=r[1:] if r=='N.': r=None else: r=loads(r) oob(c, r) else: raise UnrecognizedResult, r finally: self._last_args='' self.__call_lr()
|
def __call__(self, *args): args=dump(args,1) self.message_output(args)
|
0af8720b92ed012c2811325769d595dcdd53cb05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/0af8720b92ed012c2811325769d595dcdd53cb05/zrpc.py
|
self.assertRaises(POSException.VersionError, self._storage.load, oid, 'bogus')
|
data, revid = self._storage.load(oid, 'bogus') assert pickle.loads(data) == 11
|
def checkVersionedLoadErrors(self): oid = self._storage.new_oid() version = 'test-version' revid = self._dostore(oid, data=11) revid = self._dostore(oid, revid=revid, data=12, version=version) # Try to load a bogus oid self.assertRaises(KeyError, self._storage.load, self._storage.new_oid(), '') # Try to load a bogus version string self.assertRaises(POSException.VersionError, self._storage.load, oid, 'bogus')
|
f1ee732285102e57cecb53cb7466f9b967cd3af2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/f1ee732285102e57cecb53cb7466f9b967cd3af2/VersionStorage.py
|
assert self._storage.versionEmpty('')
|
def checkVersionEmpty(self): # Before we store anything, these versions ought to be empty version = 'test-version' assert self._storage.versionEmpty('') assert self._storage.versionEmpty(version) # Now store some objects oid = self._storage.new_oid() revid = self._dostore(oid, data=11) revid = self._dostore(oid, revid=revid, data=12) revid = self._dostore(oid, revid=revid, data=13, version=version) revid = self._dostore(oid, revid=revid, data=14, version=version) # The blank version should not be empty assert not self._storage.versionEmpty('') # Neither should 'test-version' assert not self._storage.versionEmpty(version) # But this non-existant version should be empty assert self._storage.versionEmpty('bogus')
|
f1ee732285102e57cecb53cb7466f9b967cd3af2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/f1ee732285102e57cecb53cb7466f9b967cd3af2/VersionStorage.py
|
|
assert not self._storage.versionEmpty('')
|
def checkVersionEmpty(self): # Before we store anything, these versions ought to be empty version = 'test-version' assert self._storage.versionEmpty('') assert self._storage.versionEmpty(version) # Now store some objects oid = self._storage.new_oid() revid = self._dostore(oid, data=11) revid = self._dostore(oid, revid=revid, data=12) revid = self._dostore(oid, revid=revid, data=13, version=version) revid = self._dostore(oid, revid=revid, data=14, version=version) # The blank version should not be empty assert not self._storage.versionEmpty('') # Neither should 'test-version' assert not self._storage.versionEmpty(version) # But this non-existant version should be empty assert self._storage.versionEmpty('bogus')
|
f1ee732285102e57cecb53cb7466f9b967cd3af2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/f1ee732285102e57cecb53cb7466f9b967cd3af2/VersionStorage.py
|
|
self.assertRaises(KeyError, self._storage.abortVersion, 'bogus', self._transaction)
|
def checkAbortVersionErrors(self): oid, version = self._setup_version() # Now abort a bogus version self._storage.tpc_begin(self._transaction) self.assertRaises(KeyError, self._storage.abortVersion, 'bogus', self._transaction) # And try to abort the empty version self.assertRaises(KeyError, self._storage.abortVersion, '', self._transaction) # But now we really try to abort the version oids = self._storage.abortVersion(version, self._transaction) self._storage.tpc_vote(self._transaction) self._storage.tpc_finish(self._transaction) assert len(oids) == 1 assert oids[0] == oid data, revid = self._storage.load(oid, '') assert pickle.loads(data) == 51
|
f1ee732285102e57cecb53cb7466f9b967cd3af2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/f1ee732285102e57cecb53cb7466f9b967cd3af2/VersionStorage.py
|
|
self.assertRaises(KeyError,
|
self.assertRaises(POSException.VersionError,
|
def checkAbortVersionErrors(self): oid, version = self._setup_version() # Now abort a bogus version self._storage.tpc_begin(self._transaction) self.assertRaises(KeyError, self._storage.abortVersion, 'bogus', self._transaction) # And try to abort the empty version self.assertRaises(KeyError, self._storage.abortVersion, '', self._transaction) # But now we really try to abort the version oids = self._storage.abortVersion(version, self._transaction) self._storage.tpc_vote(self._transaction) self._storage.tpc_finish(self._transaction) assert len(oids) == 1 assert oids[0] == oid data, revid = self._storage.load(oid, '') assert pickle.loads(data) == 51
|
f1ee732285102e57cecb53cb7466f9b967cd3af2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/f1ee732285102e57cecb53cb7466f9b967cd3af2/VersionStorage.py
|
self.assertRaises(POSException.VersionError, self._storage.load, oid1, version2)
|
data, revid2 = self._storage.load(oid1, version2) assert pickle.loads(data) == 51
|
def checkCommitToOtherVersion(self): oid1, version1 = self._setup_version('one') data, revid1 = self._storage.load(oid1, version1) assert pickle.loads(data) == 54 oid2, version2 = self._setup_version('two') data, revid2 = self._storage.load(oid2, version2) assert pickle.loads(data) == 54 # Let's make sure we can't get object1 in version2 self.assertRaises(POSException.VersionError, self._storage.load, oid1, version2) # Okay, now let's commit object1 to version2 self._storage.tpc_begin(self._transaction) oids = self._storage.commitVersion(version1, version2, self._transaction) self._storage.tpc_vote(self._transaction) self._storage.tpc_finish(self._transaction) assert len(oids) == 1 assert oids[0] == oid1 data, revid = self._storage.load(oid1, version2) assert pickle.loads(data) == 54 data, revid = self._storage.load(oid2, version2) assert pickle.loads(data) == 54 self.assertRaises(POSException.VersionError, self._storage.load, oid1, version1)
|
f1ee732285102e57cecb53cb7466f9b967cd3af2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/f1ee732285102e57cecb53cb7466f9b967cd3af2/VersionStorage.py
|
self.assertRaises(POSException.VersionError, self._storage.load, oid1, version1)
|
data, revid2 = self._storage.load(oid1, version1) assert pickle.loads(data) == 51
|
def checkCommitToOtherVersion(self): oid1, version1 = self._setup_version('one') data, revid1 = self._storage.load(oid1, version1) assert pickle.loads(data) == 54 oid2, version2 = self._setup_version('two') data, revid2 = self._storage.load(oid2, version2) assert pickle.loads(data) == 54 # Let's make sure we can't get object1 in version2 self.assertRaises(POSException.VersionError, self._storage.load, oid1, version2) # Okay, now let's commit object1 to version2 self._storage.tpc_begin(self._transaction) oids = self._storage.commitVersion(version1, version2, self._transaction) self._storage.tpc_vote(self._transaction) self._storage.tpc_finish(self._transaction) assert len(oids) == 1 assert oids[0] == oid1 data, revid = self._storage.load(oid1, version2) assert pickle.loads(data) == 54 data, revid = self._storage.load(oid2, version2) assert pickle.loads(data) == 54 self.assertRaises(POSException.VersionError, self._storage.load, oid1, version1)
|
f1ee732285102e57cecb53cb7466f9b967cd3af2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/f1ee732285102e57cecb53cb7466f9b967cd3af2/VersionStorage.py
|
jar=self._p_jar if self._p_changed is None: jar.setstate(self) self.__dict__[key]=value if jar is not None: try: get_transaction().register(self) self._p_changed=1 except: pass
|
jar=self._p_jar if jar is None: self.__dict__[key]=value return d=self.__dict__ if changed is None: d['_p_changed']=1 jar.setstate(self) d[key]=value try: get_transaction().register(self) d['_p_changed']=1 except: pass
|
def __setattr__(self,key,value): ' ' k=key[:3] if k=='_p_' or k=='_v_': self.__dict__[key]=value return
|
54d3adc2006e963a6fca3c0a0d984fb7d6a69613 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/54d3adc2006e963a6fca3c0a0d984fb7d6a69613/Persistence.py
|
self._r()
|
def open(self, version='', transaction=None, temporary=0, force=None, waitflag=1): """Return a object space (AKA connection) to work in
|
c0fc1c5146ba642465a3adb01ae0af0cbdf1332d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/c0fc1c5146ba642465a3adb01ae0af0cbdf1332d/DB.py
|
|
read=self._file.read h=read(DATA_HDR_LEN) doid,serial,sprev,stloc,vlen,splen = unpack(DATA_HDR, h)
|
h = self._file.read(DATA_HDR_LEN) doid, serial, sprev, stloc, vlen, splen = unpack(DATA_HDR, h)
|
def _getVersion(self, oid, pos): self._file.seek(pos) read=self._file.read h=read(DATA_HDR_LEN) doid,serial,sprev,stloc,vlen,splen = unpack(DATA_HDR, h) assert doid == oid if vlen: h=read(16) return read(vlen), h[:8] else: return '',''
|
91c7c62985ee663d922d41d132660c71bbfcb526 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/91c7c62985ee663d922d41d132660c71bbfcb526/FileStorage.py
|
h=read(16) return read(vlen), h[:8]
|
h = self._file.read(16) return self._file.read(vlen), h[:8]
|
def _getVersion(self, oid, pos): self._file.seek(pos) read=self._file.read h=read(DATA_HDR_LEN) doid,serial,sprev,stloc,vlen,splen = unpack(DATA_HDR, h) assert doid == oid if vlen: h=read(16) return read(vlen), h[:8] else: return '',''
|
91c7c62985ee663d922d41d132660c71bbfcb526 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/91c7c62985ee663d922d41d132660c71bbfcb526/FileStorage.py
|
return '',''
|
return '', ''
|
def _getVersion(self, oid, pos): self._file.seek(pos) read=self._file.read h=read(DATA_HDR_LEN) doid,serial,sprev,stloc,vlen,splen = unpack(DATA_HDR, h) assert doid == oid if vlen: h=read(16) return read(vlen), h[:8] else: return '',''
|
91c7c62985ee663d922d41d132660c71bbfcb526 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/91c7c62985ee663d922d41d132660c71bbfcb526/FileStorage.py
|
self._file.seek(pos+8) return self._file.read(8)
|
self._file.seek(pos) h = self._file.read(16) assert oid == h[:8] return h[8:]
|
def _getSerial(self, oid, pos): self._file.seek(pos+8) return self._file.read(8)
|
91c7c62985ee663d922d41d132660c71bbfcb526 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/91c7c62985ee663d922d41d132660c71bbfcb526/FileStorage.py
|
if pre: version, snv = self._getVersion(oid, pre) else: version, snv = '', ''
|
if not pre: return '', 0, '', '', ipos version, snv = self._getVersion(oid, pre)
|
def _transactionalUndoRecord(self, oid, pos, serial, pre, version): """Get the indo information for a data record
|
91c7c62985ee663d922d41d132660c71bbfcb526 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/91c7c62985ee663d922d41d132660c71bbfcb526/FileStorage.py
|
pos=pos+dlen
|
pos += dlen
|
def _txn_undo_write(self, tpos, tid): # a helper function to write the data records for transactional undo
|
91c7c62985ee663d922d41d132660c71bbfcb526 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/91c7c62985ee663d922d41d132660c71bbfcb526/FileStorage.py
|
raise ReadConflictError(oid)
|
raise ReadConflictError(object=object)
|
def commit(self, object, transaction): if object is self: # We registered ourself. Execute a commit action, if any. if self.__onCommitActions is not None: method_name, args, kw = self.__onCommitActions.pop(0) getattr(self, method_name)(transaction, *args, **kw) return oid = object._p_oid if self._conflicts.has_key(oid): self.getTransaction().register(object) raise ReadConflictError(oid) invalid = self._invalid if oid is None or object._p_jar is not self: # new object oid = self.new_oid() object._p_jar = self object._p_oid = oid self._creating.append(oid)
|
8a015a2d6972c043a338a00523d753427e4d9158 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/8a015a2d6972c043a338a00523d753427e4d9158/Connection.py
|
cn = self._connection if cn is None:
|
if self._ready.isSet(): break log2(INFO, "Wait for cache verification to finish") if self._connection is None:
|
def _wait(self): # Wait for a connection to be established. self._rpc_mgr.connect(sync=1) # When a synchronous connect() call returns, there is # a valid _connection object but cache validation may # still be going on. This code must wait until validation # finishes, but if the connection isn't a zrpc async # connection it also needs to poll for input. if self._connection.is_async(): while 1: self._ready.wait(30) if self._ready.isSet(): break log2(INFO, "Wait for cache verification to finish") else: # If there is no mainloop running, this code needs # to call poll() to cause asyncore to handle events. while 1: cn = self._connection if cn is None: # If the connection was closed while we were # waiting for it to become ready, start over. return self._wait() else: cn.pending(30) if self._ready.isSet(): break log2(INFO, "Wait for cache verification to finish")
|
a77ae75b688f8636165aa34168c2e53751de834a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/a77ae75b688f8636165aa34168c2e53751de834a/ClientStorage.py
|
cn.pending(30) if self._ready.isSet(): break log2(INFO, "Wait for cache verification to finish")
|
self._connection.pending(30)
|
def _wait(self): # Wait for a connection to be established. self._rpc_mgr.connect(sync=1) # When a synchronous connect() call returns, there is # a valid _connection object but cache validation may # still be going on. This code must wait until validation # finishes, but if the connection isn't a zrpc async # connection it also needs to poll for input. if self._connection.is_async(): while 1: self._ready.wait(30) if self._ready.isSet(): break log2(INFO, "Wait for cache verification to finish") else: # If there is no mainloop running, this code needs # to call poll() to cause asyncore to handle events. while 1: cn = self._connection if cn is None: # If the connection was closed while we were # waiting for it to become ready, start over. return self._wait() else: cn.pending(30) if self._ready.isSet(): break log2(INFO, "Wait for cache verification to finish")
|
a77ae75b688f8636165aa34168c2e53751de834a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/a77ae75b688f8636165aa34168c2e53751de834a/ClientStorage.py
|
tl=U64(stl)
|
tl=u64(stl)
|
def read_transaction_header(file, pos, file_size): # Read the transaction record file.seek(pos) h = file.read(23) if len(h) < 23: raise EOFError tid, stl, status, ul, dl, el = unpack(">8s8scHHH",h) if el < 0: el=t32-el tl=U64(stl) if status=='c': raise EOFError if pos+(tl+8) > file_size: error("bad transaction length at %s", pos) if status not in ' up': error('invalid status, %s, at %s', status, pos) if tl < (23+ul+dl+el): error('invalid transaction length, %s, at %s', tl, pos) tpos=pos tend=tpos+tl if status=='u': # Undone transaction, skip it file.seek(tend) h = file.read(8) if h != stl: error('inconsistent transaction length at %s', pos) pos = tend + 8 return pos, None pos = tpos+(23+ul+dl+el) user = file.read(ul) description = file.read(dl) if el: try: e=loads(file.read(el)) except: e={} else: e={} result = RecordIterator(tid, status, user, description, e, pos, tend, file, tpos) pos=tend # Read the (intentionally redundant) transaction length file.seek(pos) h = file.read(8) if h != stl: error("redundant transaction length check failed at %s", pos) pos += 8 return pos, result
|
0dd3ea0c37cd6a3200ec8106e49e8a094461a868 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/0dd3ea0c37cd6a3200ec8106e49e8a094461a868/fsrecover.py
|
print U64(oid), r.version, len(r.data)
|
print u64(oid), r.version, len(r.data)
|
def recover(inp, outp, verbose=0, partial=0, force=0, pack=0): print 'Recovering', inp, 'into', outp if os.path.exists(outp) and not force: die("%s exists" % outp) file = open(inp, "rb") if file.read(4) != ZODB.FileStorage.packed_version: die("input is not a file storage") file.seek(0,2) file_size = file.tell() ofs = ZODB.FileStorage.FileStorage(outp, create=1) _ts = None ok = 1 prog1 = 0 preindex = {} undone = 0 pos = 4 while pos: try: npos, transaction = read_transaction_header(file, pos, file_size) except EOFError: break except: print "\n%s: %s\n" % sys.exc_info()[:2] if not verbose: progress(prog1) pos = scan(file, pos) continue if transaction is None: undone = undone + npos - pos pos = npos continue else: pos = npos tid = transaction.tid if _ts is None: _ts = TimeStamp(tid) else: t = TimeStamp(tid) if t <= _ts: if ok: print ('Time stamps out of order %s, %s' % (_ts, t)) ok = 0 _ts = t.laterThan(_ts) tid = `_ts` else: _ts = t if not ok: print ('Time stamps back in order %s' % (t)) ok = 1 if verbose: print 'begin', if verbose > 1: print sys.stdout.flush() ofs.tpc_begin(transaction, tid, transaction.status) if verbose: print 'begin', pos, _ts, if verbose > 1: print sys.stdout.flush() nrec = 0 try: for r in transaction: oid = r.oid if verbose > 1: print U64(oid), r.version, len(r.data) pre = preindex.get(oid) s = ofs.store(oid, pre, r.data, r.version, transaction) preindex[oid] = s nrec += 1 except: if partial and nrec: ofs._status = 'p' ofs.tpc_vote(transaction) ofs.tpc_finish(transaction) if verbose: print 'partial' else: ofs.tpc_abort(transaction) print "\n%s: %s\n" % sys.exc_info()[:2] if not verbose: progress(prog1) pos = scan(file, pos) else: ofs.tpc_vote(transaction) ofs.tpc_finish(transaction) if verbose: print 'finish' sys.stdout.flush() if not verbose: prog = pos * 20l / file_size while prog > prog1: prog1 = prog1 + 1 iprogress(prog1) bad = file_size - undone - ofs._pos print "\n%s bytes removed during recovery" % bad if undone: print "%s bytes of undone transaction data were skipped" % undone if pack is not None: print "Packing ..." from ZODB.referencesf import referencesf ofs.pack(pack, referencesf) ofs.close()
|
0dd3ea0c37cd6a3200ec8106e49e8a094461a868 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/0dd3ea0c37cd6a3200ec8106e49e8a094461a868/fsrecover.py
|
revid = self._dostore(oid, revid, description='packable%d' % i)
|
revid = self._x_dostore(oid, revid, description='packable%d' % i)
|
def load_value(oid, version=''): data, revid = self._storage.load(oid, version) return zodb_unpickle(data).value
|
f1227aabc4e8f4406a79e3ba177e8f6d81e9d84e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/f1227aabc4e8f4406a79e3ba177e8f6d81e9d84e/TransactionalUndoVersionStorage.py
|
revid1 = self._dostore(oid1, data=MinPO(0), description='create1') revid2 = self._dostore(oid1, data=MinPO(1), revid=revid1,
|
revid1 = self._x_dostore(oid1, data=MinPO(0), description='create1') revid2 = self._x_dostore(oid1, data=MinPO(1), revid=revid1,
|
def load_value(oid, version=''): data, revid = self._storage.load(oid, version) return zodb_unpickle(data).value
|
f1227aabc4e8f4406a79e3ba177e8f6d81e9d84e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/f1227aabc4e8f4406a79e3ba177e8f6d81e9d84e/TransactionalUndoVersionStorage.py
|
revid3 = self._dostore(oid1, data=MinPO(2), revid=revid2,
|
revid3 = self._x_dostore(oid1, data=MinPO(2), revid=revid2,
|
def load_value(oid, version=''): data, revid = self._storage.load(oid, version) return zodb_unpickle(data).value
|
f1227aabc4e8f4406a79e3ba177e8f6d81e9d84e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/f1227aabc4e8f4406a79e3ba177e8f6d81e9d84e/TransactionalUndoVersionStorage.py
|
self._dostore(description='create2')
|
self._x_dostore(description='create2')
|
def load_value(oid, version=''): data, revid = self._storage.load(oid, version) return zodb_unpickle(data).value
|
f1227aabc4e8f4406a79e3ba177e8f6d81e9d84e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/f1227aabc4e8f4406a79e3ba177e8f6d81e9d84e/TransactionalUndoVersionStorage.py
|
revid = self._dostore(oid, revid, description='packable%d' % i)
|
revid = self._x_dostore(oid, revid, description='packable%d' % i)
|
def load_value(oid, version=''): data, revid = self._storage.load(oid, version) return zodb_unpickle(data).value
|
f1227aabc4e8f4406a79e3ba177e8f6d81e9d84e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/f1227aabc4e8f4406a79e3ba177e8f6d81e9d84e/TransactionalUndoVersionStorage.py
|
revid1 = self._dostore(oid1, data=MinPO(0), description='create1') revid2 = self._dostore(oid1, data=MinPO(1), revid=revid1,
|
revid1 = self._x_dostore(oid1, data=MinPO(0), description='create1') revid2 = self._x_dostore(oid1, data=MinPO(1), revid=revid1,
|
def load_value(oid, version=''): data, revid = self._storage.load(oid, version) return zodb_unpickle(data).value
|
f1227aabc4e8f4406a79e3ba177e8f6d81e9d84e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/f1227aabc4e8f4406a79e3ba177e8f6d81e9d84e/TransactionalUndoVersionStorage.py
|
revid3 = self._dostore(oid1, data=MinPO(2), revid=revid2,
|
revid3 = self._x_dostore(oid1, data=MinPO(2), revid=revid2,
|
def load_value(oid, version=''): data, revid = self._storage.load(oid, version) return zodb_unpickle(data).value
|
f1227aabc4e8f4406a79e3ba177e8f6d81e9d84e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/f1227aabc4e8f4406a79e3ba177e8f6d81e9d84e/TransactionalUndoVersionStorage.py
|
self._dostore(description='create2')
|
self._x_dostore(description='create2')
|
def load_value(oid, version=''): data, revid = self._storage.load(oid, version) return zodb_unpickle(data).value
|
f1227aabc4e8f4406a79e3ba177e8f6d81e9d84e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/f1227aabc4e8f4406a79e3ba177e8f6d81e9d84e/TransactionalUndoVersionStorage.py
|
if v < t32: h=0
|
if v < t32: h = 0
|
def p64(v, pack=struct.pack): """Pack an integer or long into a 8-byte string""" if v < t32: h=0 else: h=v/t32 v=v%t32 return pack(">II", h, v)
|
eabb01316360e16ae64ab20021ed2e9801cf72d2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/eabb01316360e16ae64ab20021ed2e9801cf72d2/utils.py
|
h=v/t32 v=v%t32
|
h, v = divmod(v, t32)
|
def p64(v, pack=struct.pack): """Pack an integer or long into a 8-byte string""" if v < t32: h=0 else: h=v/t32 v=v%t32 return pack(">II", h, v)
|
eabb01316360e16ae64ab20021ed2e9801cf72d2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/eabb01316360e16ae64ab20021ed2e9801cf72d2/utils.py
|
if v < 0: v=t32+v
|
if v < 0: v = t32 + v
|
def u64(v, unpack=struct.unpack): """Unpack an 8-byte string into a 64-bit (or long) integer""" h, v = unpack(">ii", v) if v < 0: v=t32+v if h: if h < 0: h=t32+h v=h*t32+v return v
|
eabb01316360e16ae64ab20021ed2e9801cf72d2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/eabb01316360e16ae64ab20021ed2e9801cf72d2/utils.py
|
if h < 0: h=t32+h v=h*t32+v
|
if h < 0: h= t32 + h v = (long(h) << 32) + v
|
def u64(v, unpack=struct.unpack): """Unpack an 8-byte string into a 64-bit (or long) integer""" h, v = unpack(">ii", v) if v < 0: v=t32+v if h: if h < 0: h=t32+h v=h*t32+v return v
|
eabb01316360e16ae64ab20021ed2e9801cf72d2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/eabb01316360e16ae64ab20021ed2e9801cf72d2/utils.py
|
v=h*t32+v
|
v = (long(h) << 32) + v
|
def U64(v, unpack=struct.unpack): """Same as u64 but always returns a long.""" h, v = unpack(">II", v) if h: v=h*t32+v return v
|
eabb01316360e16ae64ab20021ed2e9801cf72d2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/eabb01316360e16ae64ab20021ed2e9801cf72d2/utils.py
|
read=f1.read write=f2.write n=8192
|
read = f1.read write = f2.write n =8192
|
def cp(f1, f2, l): read=f1.read write=f2.write n=8192 while l > 0: if n > l: n=l d=read(n) if not d: break write(d) l = l - len(d)
|
eabb01316360e16ae64ab20021ed2e9801cf72d2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/eabb01316360e16ae64ab20021ed2e9801cf72d2/utils.py
|
if n > l: n=l d=read(n) if not d: break
|
if n > l: n = l d = read(n) if not d: break
|
def cp(f1, f2, l): read=f1.read write=f2.write n=8192 while l > 0: if n > l: n=l d=read(n) if not d: break write(d) l = l - len(d)
|
eabb01316360e16ae64ab20021ed2e9801cf72d2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10048/eabb01316360e16ae64ab20021ed2e9801cf72d2/utils.py
|
self.sql_log_model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING)
|
self.sql_log_model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING)
|
def __init__(self): #~ self.read_query(
|
288278e460646fa9d55db909479dfa7008362153 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10058/288278e460646fa9d55db909479dfa7008362153/__init__.py
|
log = self.sql_log_model.get(iter, 0, 1)
|
log = self.sql_log_model.get(iter, 0, 1, 2)
|
def __getstate__(self): hosts = [] iter = self.connections_model.get_iter_root() while iter: host = self.connections_model.get_value(iter, 0) hosts.append(host) iter = self.connections_model.iter_next(iter) sql_logs = [] iter = self.sql_log_model.get_iter_root() while iter: log = self.sql_log_model.get(iter, 0, 1) sql_logs.append(log) iter = self.sql_log_model.iter_next(iter) return {"hosts": hosts, "queries": self.queries, "sql_logs": sql_logs}
|
288278e460646fa9d55db909479dfa7008362153 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10058/288278e460646fa9d55db909479dfa7008362153/__init__.py
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.