Skip to content

Commit

Permalink
backend: add resalloc ticket info to backend.log
Browse files Browse the repository at this point in the history
And enhance the ticket info with the list of requested tags.
  • Loading branch information
praiskup committed Jan 20, 2025
1 parent ff240d3 commit fde1bd2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion backend/copr_backend/background_worker_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,11 +467,11 @@ def _alloc_host(self):
Set self.host with ready RemoteHost, and return True. Keep re-trying
upon allocation failure. Return False if the request was canceled.
"""
self.log.info("Trying to allocate VM")

vm_factory = ResallocHostFactory(server=self.opts.resalloc_connection)
while True:
self.host = vm_factory.get_host(self.job.tags, self.job.sandbox)
self.log.info("Trying to allocate VM: %s", self.host.info)
self._proctitle("Waiting for VM, info: {}".format(self.host.info))
success = CancellableThreadTask(
self.host.wait_ready,
Expand Down
6 changes: 4 additions & 2 deletions backend/copr_backend/vm_alloc.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,8 @@ class ResallocHost(RemoteHost):
https://github.com/praiskup/resalloc
"""
ticket = None

""" RESALLOC_NAME """
name = None
requested_tags = None

def parse_ticket_data(self):
"""
Expand Down Expand Up @@ -139,6 +138,8 @@ def info(self):
message += ", hostname={}".format(self.hostname)
if self.name:
message += ", name={}".format(self.name)
if self.requested_tags:
message += f", requested_tags={self.requested_tags}"
return message


Expand Down Expand Up @@ -168,4 +169,5 @@ def get_host(self, tags=None, sandbox=None):

host = ResallocHost()
host.ticket = self.conn.newTicket(request_tags, sandbox)
host.requested_tags = request_tags
return host

0 comments on commit fde1bd2

Please sign in to comment.