Drastically reduce SQL queries fired in schedule

With SQlite and 500 jobs, this reduces the scheduler's runtime from
>20s to <1s on my machine.
Start oldest waiting job first, not youngest
Bugfix: Do not try to assign when job has no tasks

This bug would prevent the scheduler from running more than one job in
the same queue simultaneously.
Do not exceed jobtype's max_batch

Even if the batch setting for the current job is higher than that.
Add locking on a lockfile for scheduler

This should prevent two copies of the scheduler from running at the same
time.
Will not work if there are multiple celery nodes in a cluster, though.
Minor fix to a comment
Use a configuration value for scheduler lockfile
Merge pull request #232 from guidow/scheduler_locking

Scheduler locking