retry jobs if they've failed less than the number of max retries

Tests need to be written