From 4c9c875d8b5033af13afc6ded706b526025c99ea Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Fri, 26 May 2023 16:59:14 +0000 Subject: [PATCH] daemon: Make job_id a property Signed-off-by: Michael Tremer --- src/pakfire/daemon.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/pakfire/daemon.py b/src/pakfire/daemon.py index fadfa4bfc..c3df4124e 100644 --- a/src/pakfire/daemon.py +++ b/src/pakfire/daemon.py @@ -214,6 +214,10 @@ class Worker(multiprocessing.Process): """ return self.data.get("test", False) + @property + def job_id(self): + return self.data.get("id") + @property def ccache(self): """ @@ -241,13 +245,12 @@ class Worker(multiprocessing.Process): """ success = False - # Extract the job id - job_id = self.data.get("id") - if not job_id: + # Check if we have received some useful data + if not self.job_id: raise ValueError("Did not receive a job ID") # Set the process title - setproctitle.setproctitle("pakfire-worker job %s" % job_id) + setproctitle.setproctitle("pakfire-worker job %s" % self.job_id) # Fetch the build architecture arch = self.data.get("arch") @@ -262,7 +265,7 @@ class Worker(multiprocessing.Process): raise ValueError("Did not received a package URL") # Connect to the hub - self.job = await self.hub.job(job_id, worker=self) + self.job = await self.hub.job(self.job_id, worker=self) # Setup build logger logger = BuildLogger(self.log, self.job) @@ -274,7 +277,7 @@ class Worker(multiprocessing.Process): # Run the build try: build = self._build(pkg, arch=arch, target=target, - logger=logger._log, build_id=job_id, + logger=logger._log, build_id=self.job_id, # Always disable using snapshots disable_snapshot=True, -- 2.39.5