Add a hidden setting to write DEBUG messages in the file log.
Fix a race issue in search_jobs_not_done().

Prevent job_busy() from being run concurrently with action_finished(),
which modifies the data queried by job_busy() and temporarily leave
them in an inconsistent state. In such a case, push_in_queue() is
tricked into mistakenly add again to the queue a job that has already
been processed.

Closes #254.
Fix another race issue in search_jobs_not_done().

The previous commit is not enough, since it may happen that
action_finished() is run on a job between when to_compile() and
job_busy() are called on it.  This would trick push_in_queue() to
mistakenly queue again the job.

In practice, I couldn't observe this behavior. I think that the
timings in the calls make it impossible or very improbable that this
scenario happen.  Anyway, this commit should fix the error and
completely close #254.

What happens with this commit is that in push_in_queue() the job is
tested again with to_compile() (or similar calls), in a new SQLAlchemy
session the lives entirely inside the post_finish_lock. This way
possible concurrent executions with action_finished() are prevented.