diff options
Diffstat (limited to 'lorrycontroller/statedb.py')
-rw-r--r-- | lorrycontroller/statedb.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lorrycontroller/statedb.py b/lorrycontroller/statedb.py index 1f18189..8316c9a 100644 --- a/lorrycontroller/statedb.py +++ b/lorrycontroller/statedb.py @@ -539,6 +539,26 @@ class StateDB(object): 'UPDATE jobs SET output=? WHERE job_id=?', (output + more_output, job_id)) + def get_all_jobs_id_path_exit(self): + '''Return id, path, and exit for all jobs. + + This is an ugly method, but it's much faster than first + getting a list of job ids and then querying path and exit for + each. Much, much faster. FTL versus the pitch drop experiment + faster. + + This is a generator. + + ''' + + c = self.get_cursor() + c.execute('SELECT job_id, path, exit FROM jobs') + while True: + row = c.fetchone() + if row is None: + break + yield row[0], row[1], row[2] + def remove_job(self, job_id): logging.debug('StateDB.append_to_job_output(%r,..) called', job_id) assert self.in_transaction |