Beispiel #1
0
 def run(self, **kwargs):
     """
     Runs the experiment. If the experiment is run on the cloud, blocks until all jobs complete.
     """
     if not self.configured:
         raise BaseException("Must configure experiment first")
     logger.debug('Running experiment')
     cloud_job_ids = []
     self.run_params = kwargs.copy()
     run_mode = kwargs.get('run_mode', 'local')
     self.run_mode = run_mode
     self.jobs = []
     for job in self.iter_jobs():
         result = job.run(**kwargs)
         if run_mode == 'cloud':
             cloud_job_ids.append(result)
         self.jobs.append(job)
     if run_mode == 'cloud':
         logger.info("Waiting for cloud jobs to finish")
         cloud.join(cloud_job_ids)
         logger.info("Cloud jobs finished")
Beispiel #2
0
 def __contains__(self, item):
     print "checking cache"
     print item
     print self.hash_key(item)
     logger.debug("bucket list is %r" % cloud.bucket.list())
     return self.hash_key(item) in cloud.bucket.list()
Beispiel #3
0
 def f():
     if run_mode == "cloud":
         store = storage.CloudStore()
     elif run_mode == "local":
         store = storage.LocalStore()
     else:
         raise BaseException("Run mode %r not recognized" % run_mode)
     store.auto_hash = False
     if use_cache and (self.key in store):
         logger.debug("Cache hit")
         return
     logger.debug("Cache miss")
     logger.debug("Running job")
     data._load_data()
     chain.data = data.train_data
     chain.data_source = data
     ioff()
     states = chain._run()
     ion()
     logger.debug('Chain completed')
     history = History()
     history.states = states
     history.job = self
     logger.debug("Summarizing chain")
     history.summary = chain.summarize(history)
     logger.debug("Chain summarized")
     logger.debug("Job params: %r" % (self.params, ))
     store[self.key] = history
     store.close()
Beispiel #4
0
 def __contains__(self, item):
     print "checking cache"
     print item
     print self.hash_key(item)
     logger.debug("bucket list is %r" % cloud.bucket.list())
     return self.hash_key(item) in cloud.bucket.list()