From: Michael Tremer Date: Sun, 26 Jan 2025 14:32:35 +0000 (+0000) Subject: jobs: Fix retrying jobs X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b88b512724028d9f702e5017e5538b9f3a45c651;p=pbs.git jobs: Fix retrying jobs Signed-off-by: Michael Tremer --- diff --git a/src/buildservice/jobs.py b/src/buildservice/jobs.py index cfeadcaa..69ed8229 100644 --- a/src/buildservice/jobs.py +++ b/src/buildservice/jobs.py @@ -924,11 +924,9 @@ class Job(database.Base, database.BackendMixin, database.SoftDeleteMixin): superseeds = self, ) + # Log action log.debug("Cloned job %s as %s" % (self, job)) - # Update cache - self.build._jobs.append(job) - return job # Retry @@ -950,7 +948,7 @@ class Job(database.Base, database.BackendMixin, database.SoftDeleteMixin): raise RuntimeError("Job %s cannot be retried" % self) # Clone the job - return self.clone() + return await self.clone() # Log diff --git a/src/templates/jobs/retry.html b/src/templates/jobs/retry.html index a0406f86..c87ca8e0 100644 --- a/src/templates/jobs/retry.html +++ b/src/templates/jobs/retry.html @@ -1,8 +1,8 @@ -{% extends "../base.html" %} +{% extends "modal.html" %} -{% block title %}{{ _("Retry Job %s") % job }}{% end block %} +{% block title %}{{ _("Retry Job %s") % job }}{% endblock %} -{% block container %} +{% block breadcrumbs %} +{% endblock %} -
-
-
-
- {% raw xsrf_form_html() %} +{% block modal_title %} +

{{ _("Retry Job") }}

+
{{ job }}
+{% endblock %} -

{{ _("Retry Job") }}

-

- {{ _("Do you want to retry building %s?") % job }} -

+{% block modal %} + + {{ xsrf_form_html() | safe }} - -
-
+
+

+ {{ _("Do you want to retry building %s?") % job }} +

-
-{% end block %} + + {# Submit! #} +
+ +
+ +{% endblock %} diff --git a/src/web/jobs.py b/src/web/jobs.py index 2ef8b8dd..3fb1d588 100644 --- a/src/web/jobs.py +++ b/src/web/jobs.py @@ -258,7 +258,7 @@ class RetryHandler(base.BaseHandler): if not job.has_perm(self.current_user): raise tornado.web.HTTPError(403) - self.render("jobs/retry.html", job=job) + await self.render("jobs/retry.html", job=job) @base.authenticated async def post(self, uuid): @@ -266,11 +266,11 @@ class RetryHandler(base.BaseHandler): if not job: raise tornado.web.HTTPError(404, "Could not find job %s" % uuid) - async with await self.db.transaction(): - job = await job.retry(self.current_user) + # Retry the job + job = await job.retry(self.current_user) - # Launch the newly created job - await self.backend.jobs.launch([job]) + # Launch the newly created job + await self.backend.jobs.launch([job]) # Redirect back to the build page self.redirect("/builds/%s" % job.build.uuid)