def initialize_backend(): allowed_db = ['filesystem', 'redis'] chosen_db = compmake_config.db #@UndefinedVariable if not chosen_db in allowed_db: user_error('Backend name "%s" not valid. I was expecting one in %s.' % (chosen_db, allowed_db)) sys.exit(-1) if compmake_config.db == 'redis': #@UndefinedVariable hostname = compmake_config.redis_host #@UndefinedVariable if ':' in hostname: # XXX this should be done elsewhere hostname, port = hostname.split(':') else: port = None use_redis(hostname, port) elif compmake_config.db == 'filesystem': #@UndefinedVariable use_filesystem(compmake_config.path) #@UndefinedVariable else: assert(False) from compmake.storage import db if not db: error('There was some error in initializing db.') sys.exit(-54)
def setUp(self): use_filesystem('test1_db') set_namespace('Test1') remove_all_jobs() reset_jobs_definition_set() self.jobs = [ ('a', Cache.DONE), ('b', Cache.FAILED), ('c', Cache.NOT_STARTED), ('d', Cache.DONE), ('e', Cache.DONE), ('f', Cache.IN_PROGRESS), ('g', Cache.DONE), ('h', Cache.FAILED), ('i', Cache.DONE), ('ii', Cache.DONE), ('v_rangefinder_nonunif-plot_tensors_tex-0', Cache.DONE), ] for job_id, state in self.jobs: comp(dummy, job_id=job_id) cache = get_job_cache(job_id) cache.state = state set_job_cache(job_id, cache) self.all = set([job_id for job_id, state in self.jobs]) select = lambda S: set([id for id, state in self.jobs if state == S]) self.failed = select(Cache.FAILED) self.done = select(Cache.DONE) self.in_progress = select(Cache.IN_PROGRESS) self.not_started = select(Cache.NOT_STARTED)
def setUp(self): self.root = mkdtemp() use_filesystem(self.root) # make sure everything was clean db = get_compmake_db() for key in db.keys(): db.delete(key) self.mySetUp()
def setUp(self): set_compmake_status(compmake_status_embedded) use_filesystem('priorities') set_namespace('priorities') # make sure everything was clean for key in storage.db.keys('*'): storage.db.delete(key) # clear the variable holding the result TestOrder.order = []
def wrapper(): root = mkdtemp() use_filesystem(root) CompmakeGlobalState.jobs_defined_in_this_session = set() # make sure everything was clean db = get_compmake_db() for key in db.keys(): db.delete(key) try: f() except: s = 'Keys in DB:' for key in db.keys(): s += ' %s\n' % key logger.error('DB state after test %s' % f) logger.error(s) raise finally: rmtree(root)
def setUp(self): use_filesystem('Simple_db') set_namespace('Simple') for key in storage.db.keys('*'): storage.db.delete(key)
def setUp(self): set_compmake_status(compmake_status_embedded) use_filesystem('unpickable') set_namespace('unpickable') for key in storage.db.keys('*'): storage.db.delete(key)