]> git.ipfire.org Git - pbs.git/commitdiff
jobs: Send a message to the builder to abort a job
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 26 Apr 2023 17:22:38 +0000 (17:22 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 26 Apr 2023 17:22:38 +0000 (17:22 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/buildservice/jobs.py

index d7ebdb94581fc0cc5a1d27a2c270add9a8bf313e..aaac17b00c3f9b9c5ece89e8a6fd543b447f39c3 100644 (file)
@@ -466,6 +466,13 @@ class Job(base.DataObject):
                """
                        Aborts the job
                """
+               # Tell the builder to abort the job
+               if self.connection:
+                       await self.connection.write_message({
+                               "type" : "abort",
+                               "data" : {},
+                       })
+
                # Mark as finished
                self._set_attribute_now("finished_at")
 
@@ -474,9 +481,6 @@ class Job(base.DataObject):
                if user:
                        self._set_attribute("aborted_by", user)
 
-               # Dispatch more jobs
-               await self.backend.jobs.queue.dispatch()
-
        def is_aborted(self):
                """
                        Returns True if this job has been aborted