db.py: added in methods to access, add and update jobs in db.
db.py: added in methods to access logs and change states.

Also included tests for these method in test_db.py