code: def cancel(self):
          
          if self.queue_id is None: return 0
          if self.status >= self.S_DONE: return 0
  
          exit_status = self.manager.cancel(self.queue_id)
          if exit_status != 0:
              logger.warning("manager.cancel returned exit_status: %s" % exit_status)
              return 0
  
          # Remove output files and reset the status.
          self.history.info("Job %s cancelled by user" % self.queue_id)
          self.reset()
          return 1
docs: Cancel the job. Returns 1 if job was cancelled.