Update to address review comments

Remove custom SQL
Use ListView
Use override_settings
Introduce ValidTaskAttemptFactory