Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Worker fails to run with Python 3.11 #3202

Closed
saschamarkus-uberresearch opened this issue Oct 27, 2022 · 4 comments
Closed

Worker fails to run with Python 3.11 #3202

saschamarkus-uberresearch opened this issue Oct 27, 2022 · 4 comments

Comments

@saschamarkus-uberresearch
Copy link

When migrationg a batch pipeline with multiple workers to Python 3.11 the workers fails to run.

Stacktrace:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/pack/app/venv/lib/python3.11/site-packages/luigi/worker.py", line 297, in run
    super(ContextManagedTaskProcess, self).run()
  File "/pack/app/venv/lib/python3.11/site-packages/luigi/worker.py", line 168, in run
    random.seed((processID, currentTime))
  File "/usr/local/lib/python3.11/random.py", line 160, in seed
    raise TypeError('The only supported seed types are: None,\n'
TypeError: The only supported seed types are:

The error is caused by a change in random.seed() for Python 3.11

Changed in version 3.11: The seed must be one of the following types: NoneType, int, float, str, bytes, or bytearray.

The issue can be reproduced by running
pytest -c /dev/null test/worker_task_process_test.py
which fails on test_context_manager_with_multiprocessing

One possible fix would be to replace
random.seed((processID, currentTime))
with something like
random.seed(processID * currentTime)
or
random.seed(str((processID, currentTime)))

davidesba added a commit to davidesba/luigi that referenced this issue Nov 3, 2022
Fix compatibility error with python 3.11: spotify#3202
dlstadther pushed a commit that referenced this issue Nov 4, 2022
Fix compatibility error with python 3.11: #3202
@jmrnilsson
Copy link

Hmm, I hit this too. Let's check for new version..

@jmrnilsson
Copy link

No reverting back to Python 3.9 works though. So it's a work-around..

@dlstadther
Copy link
Collaborator

@jmrnilsson , the patch that @davidesba submitted in currently in master if you want to try it. It'll be included in a future (date tbd) versioned release of the project.

@saschamarkus-uberresearch
Copy link
Author

@jmrnilsson
If you use the pyproject.toml/setup.cfg way to set up your project you can use the master branch from git instead of the release from pypy with this in your setup.cfg. There ist probably a similar way for the requirements.txt

[options]
packages = find:
install_requires =
  luigi @ git+https://github.com/spotify/luigi.git 

miku added a commit to ubleipzig/siskin that referenced this issue Jan 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants