Scheduler emails

Adds email alerts when scheduler tasks fail, as well as making needed improvements to PyCodeError handling in general due to the new `compute.py`.

This is a branch off `fix-jia` which has not been merged yet, so the changes for both will be seen below.