# Run the build
try:
- build = self._build(pkg, arch=arch, target=target,
+ build = self.build(pkg, arch=arch, target=target,
logger=logger._log, build_id=self.job_id,
# Always disable using snapshots
packages=packages,
)
- def _build(self, pkg, arch=None, logger=None, **kwargs):
+ def build(self, *args, **kwargs):
"""
Sets up a new Pakfire instance and runs it in a new thread.
This method returns an async.Task() object which can be used to track
if this job is still running.
"""
+ thread = asyncio.to_thread(self._build, *args, **kwargs)
+
+ return asyncio.create_task(thread)
+
+ def _build(self, pkg, arch=None, logger=None, **kwargs):
# Setup Pakfire instance
try:
p = _pakfire.Pakfire(arch=arch, conf=self.pakfire_conf, logger=logger)
# Delete the configuration file
os.unlink(self.pakfire_conf)
- # Run the build in a new thread
- thread = asyncio.to_thread(p.build, pkg, **kwargs)
-
- # Return a task
- return asyncio.create_task(thread)
+ # Run the build
+ return p.build(pkg, **kwargs)
def shutdown(self):
self.log.debug("Shutting down worker %s" % self.pid)