delete job if it admits to being invalid

Introduces a new exception JobInvalid that can be raised by a job when it realises that it is invalid (e.g. depends on a record that has since been deleted).