#3007 better error messages for Task.lock()
Merged by tkopecek. Opened by tkopecek.
tkopecek/koji issue2834  into  master

Download 3007.patch

Related: https://pagure.io/koji/issue/2834

@mikem I'm not sure about ASSIGNED case - it seems to me that it also shouldn't log an error?

elif state == koji.TASK_STATES['OPEN'] and otherhost is None:
    log_error(f"Error: task {task_id} is opened but not locked by any host")
    return False

This probably needs to open with simply elif state == koji.TASK_STATES['OPEN']: and cover some different sanity rules for open tasks.

  • if the open task has no host, then that is an error that needs logging
  • if the open task has a different host, then that is a normal, non-error case (another host won the race) and we can simply return False.
  • if the open task has the same host, then that is probably worth logging. It either means there was a double open, or an admin trying to assign a task to a host that already has it.

I'm not sure about ASSIGNED case

It depends on the particulars. I think the case where the state is assigned but there is no host_id is unexpected and worth an error message.

For assigned in particular, the sanity checks might need to depend on newstate as well. I.e. it might be worth noting a double assign (same host id, state=newstate=assigned), but perfectly normal and expected for that host to open the assigned task.

makes sense, updated

rebased onto 8dc2b5d2290f98def3b7afac717b5e6801741dc9

:thumbsup:

Metadata Update from @tkopecek:
- Pull-request tagged with: testing-ready

rebased onto 2f336d0d5bfeeb78107e1c90f60879f55b6abf5e

Metadata Update from @jobrauer:
- Pull-request tagged with: testing-done

Commit c69ed04d fixes this pull-request

Pull-Request has been merged by tkopecek

Metadata