await self.job.status("building")
# Run the build
- build = self._build(pkg, arch=arch,
- logger=logger._log, build_id=job_id)
+ try:
+ build = self._build(pkg, arch=arch,
+ logger=logger._log, build_id=job_id)
+
+ # Wait until the build process is done and stream the log in the meantime
+ while not build.done():
+ await logger.stream(timeout=1)
- # Wait until the build process is done and stream the log in the meantime
- while not build.done():
- await logger.stream(timeout=1)
+ finally:
+ # Upload the build log
+ log_upload_id = await self.hub.upload(
+ logger.logfile.name,
+ filename="%s.log" % job_id,
+ )
def _build(self, pkg, arch=None, logger=None, **kwargs):
"""
self.job = job
# Create a logfile
- self.logfile = tempfile.SpooledTemporaryFile(mode="w+", max_size=1048576)
+ self.logfile = tempfile.NamedTemporaryFile()
# Create a FIFO queue to buffer any log messages
self.queue = asyncio.Queue()