#621 [backend] cast job into string to log it properly, fix #488
Closed 5 years ago by frostyx. Opened 5 years ago by frostyx.
copr/ frostyx/copr buildjob-in-logs  into  master

@@ -172,12 +172,12 @@ 

                  # allocate new vm and run full build

                  try:

                      vm_group_ids = self.get_vm_group_ids(job.arch)

-                     self.log.info("Picking VM from groups %s for job %s", vm_group_ids, job)

+                     self.log.info("Picking VM from groups %s for job %s", vm_group_ids, str(job))

                      vm = self.vm_manager.acquire_vm(vm_group_ids, job.project_owner, self.next_worker_id,

                                                      job.task_id, job.build_id, job.chroot)

                  except NoVmAvailable as error:

                      self.log.info("No available resources for task %s (Reason: %s). Deferring job.",

-                                   job.task_id, error)

+                                   job.task_id, str(error))

                      continue

                  else:

                      self.log.info("VM %s for job %s successfully acquired", vm.vm_name, job.task_id)

I have enough for today :poop:
It meant to be #488, I will rebase.

Np, understood now ... btw., don't you know how to explain that the object.str() isn't used automatically?

Fwiw, original issue mentions two issues:

[2019-01-10 10:40:02,016][  INFO][backend.build_dispatcher][build_dispatcher.py:run:180] No available resources for task 836116 (Reason: can't convert <class 'backend.exceptions.NoVmAvailable'>). Deferring job.
[2019-01-10 10:40:02,019][  INFO][backend.build_dispatcher][build_dispatcher.py:run:175] Picking VM from groups [0, 1] for job can't convert <class 'backend.job.BuildJob'>

rebased onto fbc42f6

5 years ago

Fwiw, original issue mentions two issues:

Ah, thank you for pointing that out. Fixed

It meant to be #488, I will rebase.

Rebased

It is somewhat inconvenient that "%s" doesn't cast it automatically ... so we'll have to think about this problem forever in new code :-( I'd really love to at least understand what is going on here.

An alternative thingy is in #625 (if that is correct, we shouldn't really be required to retype each log message argument).

An alternative thingy is in #625

An alternative thingy is merged, I am closing this PR.

Pull-Request has been closed by frostyx

5 years ago