#2672 Something is wrong with getTaskInfo() returned data in fedora koji
Closed: Fixed 2 years ago by mohanboddu. Opened 3 years ago by mohanboddu.

While running the script we were hit with

Traceback (most recent call last):
  File "/home/mboddu/pagure/releng/./scripts/mass-tag.py", line 86, in <module>
    for [request] in requests:
ValueError: too many values to unpack (expected 1)

We realized there is a problem with the returned value of getTaskInfo() and found the data set as

[
   {
      "arch":"noarch",
      "awaited":"None",
      "channel_id":1,
      "completion_time":"2021-01-31 12:05:47.430337+00:00",
      "completion_ts":1612094747.430337,
      "create_time":"2021-01-31 11:59:39.462129+00:00",
      "create_ts":1612094379.462129,
      "host_id":467,
      "id":60967716,
      "label":"None",
      "method":"build",
      "owner":2498,
      "parent":"None",
      "priority":20,
      "start_time":"2021-01-31 11:59:40.017626+00:00",
      "start_ts":1612094380.017626,
      "state":2,
      "waiting":false,
      "weight":0.2,
      "request":[
         "git+https://src.fedoraproject.org/rpms/gnome-sound-recorder.git#c8885bd741c484571c2acd142485ba58559bf002",
         "rawhide",
         {

         }
      ]
   }
],
{
   "faultCode":1,
   "faultString":"int() argument must be a string, a bytes-like object or a number, not 'NoneType'",
   "traceback":[
      "Traceback (most recent call last):\n",
      "  File \"/usr/share/koji-hub/kojixmlrpc.py\", line 333, in multiCall\n    result = self._dispatch(call[\\'methodName\\'], call[\\'params\\'])\n",
      "  File \"/usr/share/koji-hub/kojixmlrpc.py\", line 314, in _dispatch\n    ret = koji.util.call_with_argcheck(func, params, opts)\n",
      "  File \"/usr/lib/python3.9/site-packages/koji/util.py\", line 271, in call_with_argcheck\n    return func(*args, **kwargs)\n",
      "  File \"/usr/share/koji-hub/kojihub.py\", line 12133, in getTaskInfo\n    ret = [Task(id).getInfo(strict, request) for id in task_id]\n",
      "  File \"/usr/share/koji-hub/kojihub.py\", line 12133, in <listcomp>\n    ret = [Task(id).getInfo(strict, request) for id in task_id]\n",
      "  File \"/usr/share/koji-hub/kojihub.py\", line 122, in __init__\n    self.id = int(id)\n",
      "TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'\n"
   ]
},
[
   {
      "arch":"noarch",
      "awaited":"None",
      "channel_id":1,
      "completion_time":"2021-01-31 16:47:32.997871+00:00",
      "completion_ts":1612111652.997871,
      "create_time":"2021-01-31 16:43:40.753083+00:00",
      "create_ts":1612111420.753083,
      "host_id":407,
      "id":60977303,
      "label":"None",
      "method":"build",
      "owner":994,
      "parent":"None",
      "priority":20,
      "start_time":"2021-01-31 16:43:45.738576+00:00",
      "start_ts":1612111425.738576,
      "state":2,
      "waiting":false,
      "weight":0.2,
      "request":[
         "git+https://src.fedoraproject.org/rpms/gnome-sound-recorder.git#cbe6b9897636ec9225c1aa6c21c74b0af449f1b9",
         "f33-candidate",
         {

         }
      ]
   }
],

Not sure where the fault is, let us know what is the issue and how it happened and how we can fix it in our db.


Do you've that failing task id? Note that not all builds need to have task_id. E.g. OSBS can import content without it.

Metadata Update from @tkopecek:
- Custom field Size adjusted to None

3 years ago

Unfortunately I dont have the task id for it :cry:

I suspect that the answer is task_id = None

We've a recent-ish change (#2544, included since 1.23) that validates the id use to initialize a Task instance. Previously, the id value not converted to an int and in some cases, like the Task.getInfo called from getTaskInfo, an value of None would work and yield a result of None without error (e.g. the query includes WHERE (id = NULL)).

E.g. with 1.22, I get

[mikem@localhost koji]$ python3 ./devtools/fakehub getTaskInfo None
-snip-
None

With with 1.23 on, I get:

[mikem@localhost koji]$ python3 ./devtools/fakehub getTaskInfo None
RESULT:
2021-02-19 16:57:42,783 [INFO] m=getTaskInfo u=None p=29021 r=?:? koji.xmlrpc: Handling method getTaskInfo for session None (#None)
2021-02-19 16:57:42,783 [DEBUG] m=getTaskInfo u=None p=29021 r=?:? koji.xmlrpc: Params: (None,)
2021-02-19 16:57:42,784 [DEBUG] m=getTaskInfo u=None p=29021 r=?:? koji.xmlrpc: Opts: {}
2021-02-19 16:57:42,791 [WARNING] m=getTaskInfo u=None p=29021 r=?:? koji.xmlrpc: Traceback (most recent call last):
  File "/home/mikem/Devel/koji/koji/hub/kojixmlrpc.py", line 253, in _wrap_handler
    response = handler(environ)
  File "/home/mikem/Devel/koji/koji/hub/kojixmlrpc.py", line 277, in handle_rpc
    return self._dispatch(method, params)
  File "/home/mikem/Devel/koji/koji/hub/kojixmlrpc.py", line 314, in _dispatch
    ret = koji.util.call_with_argcheck(func, params, opts)
  File "/home/mikem/Devel/koji/koji/koji/util.py", line 271, in call_with_argcheck
    return func(*args, **kwargs)
  File "/home/mikem/Devel/koji/koji/hub/kojihub.py", line 12168, in getTaskInfo
    ret = [Task(id).getInfo(strict, request) for id in task_id]
  File "/home/mikem/Devel/koji/koji/hub/kojihub.py", line 12168, in <listcomp>
    ret = [Task(id).getInfo(strict, request) for id in task_id]
  File "/home/mikem/Devel/koji/koji/hub/kojihub.py", line 122, in __init__
    self.id = int(id)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

None is not a valid task id, so the call really should error, but we should fix the error to be more informative..

/me looks at script

oof old script

You should modernize your multicall usage. See the multicall section in https://docs.pagure.org/koji/writing_koji_code/

You are assuming that task_id value for builds is not None. This is not a safe assumption.

It is questionable to rely on task parameters like this, and the overall logic of this script seems suspect. I suspect it could be refactored to be simpler and faster. Why does it need to dig up the build target? Couldn't it just filter on the actual tags? Build targets result in a build being tagged, unless --skip-tag is used (and if it was, there was probably a reason).

Is it ok to close this one?

Yeah, this can be closed now.

Metadata Update from @mohanboddu:
- Issue close_status updated to: Fixed
- Issue status updated to: Closed (was: Open)

2 years ago

Login to comment on this ticket.

Metadata