def _ModifyJobUnlocked(self, job_id, mod_fn):
    job = self._LoadJobUnlocked(job_id)
    if not job:
      logging.debug("Job %s not found", job_id)
      return (False, "Job %s not found" % job_id)

    assert job.writable, "Can't modify read-only job"
    assert not job.archived, "Can't modify archived job"

    (success, msg) = mod_fn(job)

    if success:
      # If the job was finalized (e.g. cancelled), this is the final write
      # allowed. The job can be archived anytime.
      self.UpdateJobUnlocked(job)

    return (success, msg)
Modifies a job.
dataset/ETHPy150Open ganeti/ganeti/lib/jqueue/__init__.py/JobQueue._ModifyJobUnlocked