pulp/pulpcore

pulp-worker fails to start with a "float object cannot be interpreted as an integer" error

Closed this issue · 0 comments

Version
3.64.0 and below.

Describe the bug
I'm perfectly happy to agree with you that this should not happen, however it appears that some patch versions of python have a bug that prevents pulp-worker from starting. It's easy enough to pass an explicit integer though, PR incoming.

To Reproduce

$ python --version
Python 3.12.3
$ python -c "from random import randint; randint(100 / 10, 100)"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.12/random.py", line 336, in randint
    return self.randrange(a, b+1)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/random.py", line 301, in randrange
    istart = _index(start)
             ^^^^^^^^^^^^^
TypeError: 'float' object cannot be interpreted as an integer
Traceback (most recent call last):
  File "/venv/bin/pulpcore-worker", line 8, in <module>
    sys.exit(worker())
             ^^^^^^^^
  File "/venv/lib/python3.12/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib/python3.12/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/venv/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib/python3.12/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib/python3.12/site-packages/pulpcore/tasking/entrypoint.py", line 43, in worker
    PulpcoreWorker().run(burst=burst)
    ^^^^^^^^^^^^^^^^
  File "/venv/lib/python3.12/site-packages/pulpcore/tasking/worker.py", line 73, in __init__
    self.worker_cleanup_countdown = random.randint(
                                    ^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/random.py", line 336, in randint
    return self.randrange(a, b+1)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/random.py", line 301, in randrange
    istart = _index(start)
             ^^^^^^^^^^^^^
TypeError: 'float' object cannot be interpreted as an integer