code: def should_recover(self):
          
          return (self.checkpoint_freq > 0
                  and (self.num_failures < self.max_failures
                       or self.max_failures < 0))
docs: Returns whether the trial qualifies for restoring.
  
          This is if a checkpoint frequency is set and has not failed more than
          max_failures. This may return true even when there may not yet
          be a checkpoint.