]> git.ipfire.org Git - pbs.git/commitdiff
jobs: Launch installcheck in transactions and wait for it
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 2 Aug 2023 17:17:36 +0000 (17:17 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 2 Aug 2023 17:17:36 +0000 (17:17 +0000)
It can happen that a transaction is being rolled back and an
installcheck has been queued which will then run into errors.

Since the installcheck is now fast enough, we can simply wait for it
with the exception of relaunching any pending jobs in repositories which
will be run as one single task in the background.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/buildservice/jobs.py
src/buildservice/releasemonitoring.py
src/web/jobs.py

index 5dbe8538afe91ff00770aeb885c82b22b1b50e7e..87800ad953ce7e46991a802ae82db9b3459a06b9 100644 (file)
@@ -173,14 +173,8 @@ class Jobs(base.Object):
                repos = misc.group(jobs, lambda job: job.build.build_repo)
 
                # Run the dependency check for each repository concurrently
-               async with asyncio.TaskGroup() as tasks:
-                       for repo in repos:
-                               tasks.create_task(
-                                       repo.installcheck(repos[repo])
-                               )
-
-               # Dispatch any jobs
-               await self.backend.jobs.queue.dispatch()
+               for repo in repos:
+                       await repo.installcheck(repos[repo])
 
 
 class Queue(base.Object):
index 44987ff9a03fa8a734ab805021cb7d1c60a700be..6306fa03bfa122a08fe3bdf36537cdcfe09d504b 100644 (file)
@@ -332,9 +332,8 @@ class Monitoring(base.DataObject):
                        except BuildExistsError as e:
                                log.debug("Latest build is newer")
 
-               # Launch the build
-               if release and release.build:
-                       await self.backend.builds.launch([release.build])
+               # Dispatch any jobs
+               await self.backend.jobs.queue.dispatch()
 
        async def _fetch_versions(self):
                """
@@ -753,6 +752,9 @@ class Release(base.DataObject):
                        self.build = build
                        self.repo  = repo
 
+               # Launch the build
+               await self.backend.builds.launch([build])
+
        async def _update_source_package(self, package, target):
                """
                        Takes a package and recreates it with this release
index 813532abab722a3e9d3a7667be96c7bd72b6721a..598c366b94fb5a167af344848f2b315c3ddb0670 100644 (file)
@@ -245,8 +245,8 @@ class RetryHandler(base.BaseHandler):
                with self.db.transaction():
                        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)