MAJ terminée. Nous sommes passés en version 14.6.2 . Pour consulter les "releases notes" associées c'est ici :

https://about.gitlab.com/releases/2022/01/11/security-release-gitlab-14-6-2-released/
https://about.gitlab.com/releases/2022/01/04/gitlab-14-6-1-released/

Commit dbb92573 authored by BAIRE Anthony's avatar BAIRE Anthony
Browse files

controller: always update the redis db after processing a job

This way we get redis updates when a job is deleted and this also
prevents inserting a 'DONE' state when the job is not done

Note: we never update the redis job state key from the django server to
avoid race conditions
parent 56ae85bf
Pipeline #36218 failed with stage
in 39 seconds
...@@ -1425,8 +1425,8 @@ class JobManager(Manager): ...@@ -1425,8 +1425,8 @@ class JobManager(Manager):
job.state = int(JobState.DONE) job.state = int(JobState.DONE)
# TODO report error to the user # TODO report error to the user
job.result= int(JobResult.ERROR) job.result= int(JobResult.ERROR)
return else:
info.ver_id = ver.id info.ver_id = ver.id
elif state in (JobState.RUNNING, JobState.ABORTING): # pragma: nobranch elif state in (JobState.RUNNING, JobState.ABORTING): # pragma: nobranch
# job is already started # job is already started
...@@ -1462,11 +1462,6 @@ class JobManager(Manager): ...@@ -1462,11 +1462,6 @@ class JobManager(Manager):
info.timeout -= uptime info.timeout -= uptime
log.debug("job %d uptime: %.1fs, adjusted timeout is: %.1f", log.debug("job %d uptime: %.1fs, adjusted timeout is: %.1f",
info.job_id, uptime, info.timeout) info.job_id, uptime, info.timeout)
else:
# unexpected state
if state != JobState.DONE:
log.warning("job id %d is in unexpected state %s", job_id, state.name)
return
if state == JobState.WAITING: if state == JobState.WAITING:
...@@ -1493,10 +1488,18 @@ class JobManager(Manager): ...@@ -1493,10 +1488,18 @@ class JobManager(Manager):
# -> wait for its termination # -> wait for its termination
yield from self._finish_job(info, reset) yield from self._finish_job(info, reset)
# replicate the job status/result in the redis database (this is needed
# for transitions to state DONE, but also to DELETED and ARCHIVED
# because the django server does not write any job state in redis)
with ses.begin(): with ses.begin():
job = ses.query(Job).filter_by(id=job_id).first() job = ses.query(Job).filter_by(id=job_id).first()
result = None if job is None else JobResult(job.result).name if job is None:
yield from self._notif_job_state(info, "DONE", result) state, result = "DELETED", None
else:
state = JobState (job.state) .name
result = JobResult(job.result).name
yield from self._notif_job_state(info, state, result)
# send a notification to the aio frontend when the job state is changed # send a notification to the aio frontend when the job state is changed
# #
......
...@@ -66,7 +66,7 @@ from .forms import ( ...@@ -66,7 +66,7 @@ from .forms import (
WebappForm, WebappForm,
WebappSandboxForm, WebappSandboxForm,
) )
from .helpers import get_ssh_data, upload_data from .helpers import get_ssh_data, upload_data, notify_controller
from .signals import job_post_save from .signals import job_post_save
from .templatetags.converters import status_icon from .templatetags.converters import status_icon
...@@ -698,6 +698,7 @@ class JobDelete(LoginRequiredMixin, DeleteView): ...@@ -698,6 +698,7 @@ class JobDelete(LoginRequiredMixin, DeleteView):
transaction.commit() transaction.commit()
self.object = job = self.get_object() self.object = job = self.get_object()
notify_controller(job) # so that the DELETED/ARCHIVED state is propagated into the redis db
# delete the data dir if present # delete the data dir if present
# FIXME: if this fail then we have dangling files staying in the way # FIXME: if this fail then we have dangling files staying in the way
......
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