Limit requeues for task on failures, not attempts

This way, a failed task that is being manually rerun will have its full
number of possible requeues again.
Delete all dependent jobs on deleting a job
Rollback, don't commit left over transactions

Celery keeps the state of global objects inside of the same worker from
one execution of a task to the next.  In this case, that mean db.session
objects are carried over, including their transaction state.

If there is a transaction left over from a previous task, it is better
to roll it back than to commit it.  This should also help with
db.session objects that are caught in an invalid transaction state,
because those not an explicit rollback to start a new transaction.
Rework delete_task celery task to be more robust

Checking whether the job this task belonged to should be deleted as well
is now done in a separate, new transaction.  This means that, at that
point, we also get to see changes that other transactions have made in
the time since our first one started.  This should help with some
concurrency issues that used to plague job deletions.

Failed transactions are now explicitly rolled back and retried up to ten
times.
Import InvalidRequestError to pacify pylint
Update job state in separate transactions

This is to solve a concurrency issue where sometimes a job's state isn't
set after the last task has been set to DONE or FAILED.
Actually include mail recipients in the header

Instead oof just in the SMTP envelope
Delete tasks/jobs synchronously if possible
Merge pull request #284 from guidow/limit_requeues_on_failures

Limit requeues for task on failures, not attempts
Merge pull request #290 from guidow/mail_to_in_header

Actually include mail recipients in the header
Merge pull request #291 from guidow/synchronous_task_delete

Delete tasks/jobs synchronously if possible
Rename id to id_ to avoid conflict with builtin
Merge pull request #292 from guidow/delete_dependent_jobs

Delete dependent jobs
Make transaction retries configurable
Use %r in logstring:wq:
Merge pull request #288 from guidow/more_robust_task_deletion

More robust task deletion
Change %s to %r in logstrings
Merge pull request #289 from guidow/job_state_update_in_new_tx

Update job state in separate transactions