diff options
Diffstat (limited to 'lorrycontroller/statedb.py')
-rw-r--r-- | lorrycontroller/statedb.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lorrycontroller/statedb.py b/lorrycontroller/statedb.py index fd7857d..7a26098 100644 --- a/lorrycontroller/statedb.py +++ b/lorrycontroller/statedb.py @@ -473,6 +473,19 @@ class StateDB(object): 'output': row[10], } + def get_jobs_for_lorry(self, path): + c = self.get_cursor() + c.execute('SELECT job_id FROM jobs WHERE path=?', (path,)) + return [row[0] for row in c.fetchall()] + + def get_failed_jobs_for_lorry(self, path): + c = self.get_cursor() + c.execute( + 'SELECT job_id FROM jobs ' + 'WHERE path=? AND exit != \'no\' AND exit != 0', + (path,)) + return [row[0] for row in c.fetchall()] + def add_new_job(self, job_id, host, pid, path, started): logging.debug( 'StateDB.add_new_job(%r, %r, %r, %r, %r) called', |