Clean up orphaned tasks logs

Addresses #229

Without this, tasklogs will accumulate over time and eventually fill up
the master's disk.
These imports should go with the others at the top of the module.