Commit 6b30c20c authored by BAIRE Anthony's avatar BAIRE Anthony
Browse files

fix var not initialised

parent 9d93321e
......@@ -1032,6 +1032,16 @@ class JobManager(Manager):
# unknown job
log.warning("unknown job id %d", job_id)
return
state = JobState(job.state)
if job.webapp is None:
log.error("job %d: webapp id %r not found", job_id, job.webapp_id)
if state == JobState.WAITING: # pragma: nobranch
job.state = int(JobState.DONE)
job.exec_time = 0
# TODO report error to the user ?
return
info = self.JobInfo()
info.job_id = job_id
......@@ -1048,24 +1058,14 @@ class JobManager(Manager):
info.watcher = ctrl.swarm_watcher
state = JobState(job.state)
if state == JobState.WAITING:
# job is not yet started
if job.webapp is None:
log.error("job %d: webapp id %r not found", job_id, job.webapp_id)
job.state = JobState.DONE
# TODO report error to the user
return
if job.version == "sandbox":
# to be run in the sandbox
info.ver_id = None
else:
# to be run in the swarm
#TODO: replace version_id with webapp_version_id
ver = ses.query(WebappVersion).filter_by(
webapp_id = job.webapp_id,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment