Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
class BsddbTarget(luigi.LocalTarget):
def open(self, mode):
return bsddb.hashopen(self.path, mode) # TODO: make this atomic!!
class TCTarget(luigi.LocalTarget):
open_tcs = {}
def open(self, mode):
if mode == 'r':
if self.path not in TCTarget.open_tcs:
hdb = pytc.HDB()
hdb.open(self.path, pytc.HDBOREADER)
TCTarget.open_tcs[self.path] = hdb
else:
hdb = TCTarget.open_tcs[self.path]
elif mode == 'w':
hdb = pytc.HDB()
hdb.open(self.path, pytc.HDBOWRITER | pytc.HDBOCREAT)
return hdb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment