in lib/transform_jobs.py [0:0]
def __call__(self, user_jobs):
for uuid in self.old_uuids:
job_file = self.jobs_dir / ("%s.json" % uuid)
try:
with open(job_file) as handle:
old_job = json.load(handle)
uuid = old_job["job_id"]
except FileNotFoundError:
logging.warning(
"file for job %s disappeared; not updating", uuid)
continue
updated_job = [
j for j in user_jobs if j["job_id"] == uuid
]
if not updated_job:
self._delete_job(old_job)
elif len(updated_job) > 1:
logging.error(
"user input contained two jobs with uuid %s", uuid)
sys.exit(1)
elif updated_job[0] == old_job:
self._write_unmodified_job(old_job)
else:
self._write_transformed_job(updated_job[0])
new_jobs = [
j for j in user_jobs
if j["job_id"] not in self.old_uuids]
for job in new_jobs:
self._write_new_job(job)