code: def check_log(logfile, exited='Exited with exit code',
                successful='Successfully completed'):
      
      if not os.path.exists(logfile):
          return JobStatus.ready
      if exited in open(logfile).read():
          return JobStatus.failed
      elif successful in open(logfile).read():
          return JobStatus.done
      return JobStatus.running
docs: Check a log file to determine status of LSF job
  
      Often logfile doesn't exist because the job hasn't begun
      to run. It is unclear what you want to do in that case...
  
      Parameters
      ----------
  
      logfile : str
          String with path to logfile
  
      exited  : str
          Value to check for in existing logfile for exit with failure
  
      successful : str
          Value to check for in existing logfile for success
  
      Returns str, one of 'Pending', 'Running', 'Done', 'Failed'