Fix reboots caused by psycopg2 exceptions in executions worker
pablosnt opened this issue · 0 comments
pablosnt commented
Fix the following exception:
executions-worker_1 | Traceback (most recent call last):
executions-worker_1 | File "/code/manage.py", line 22, in <module>
executions-worker_1 | main()
executions-worker_1 | File "/code/manage.py", line 18, in main
executions-worker_1 | execute_from_command_line(sys.argv)
executions-worker_1 | File "/usr/local/lib/python3.11/dist-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
executions-worker_1 | utility.execute()
executions-worker_1 | File "/usr/local/lib/python3.11/dist-packages/django/core/management/__init__.py", line 395, in execute
executions-worker_1 | django.setup()
executions-worker_1 | File "/usr/local/lib/python3.11/dist-packages/django/__init__.py", line 24, in setup
executions-worker_1 | apps.populate(settings.INSTALLED_APPS)
executions-worker_1 | File "/usr/local/lib/python3.11/dist-packages/django/apps/registry.py", line 114, in populate
executions-worker_1 | app_config.import_models()
executions-worker_1 | File "/usr/local/lib/python3.11/dist-packages/django/apps/config.py", line 301, in import_models
executions-worker_1 | self.models_module = import_module(models_module_name)
executions-worker_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
executions-worker_1 | File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
executions-worker_1 | return _bootstrap._gcd_import(name[level:], package, level)
executions-worker_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
executions-worker_1 | File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
executions-worker_1 | File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
executions-worker_1 | File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
executions-worker_1 | File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
executions-worker_1 | File "<frozen importlib._bootstrap_external>", line 940, in exec_module
executions-worker_1 | File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
executions-worker_1 | File "/usr/local/lib/python3.11/dist-packages/django/contrib/auth/models.py", line 3, in <module>
executions-worker_1 | from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
executions-worker_1 | File "/usr/local/lib/python3.11/dist-packages/django/contrib/auth/base_user.py", line 48, in <module>
executions-worker_1 | class AbstractBaseUser(models.Model):
executions-worker_1 | File "/usr/local/lib/python3.11/dist-packages/django/db/models/base.py", line 122, in __new__
executions-worker_1 | new_class.add_to_class('_meta', Options(meta, app_label))
executions-worker_1 | File "/usr/local/lib/python3.11/dist-packages/django/db/models/base.py", line 326, in add_to_class
executions-worker_1 | value.contribute_to_class(cls, name)
executions-worker_1 | File "/usr/local/lib/python3.11/dist-packages/django/db/models/options.py", line 207, in contribute_to_class
executions-worker_1 | self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
executions-worker_1 | ^^^^^^^^^^^^^^
executions-worker_1 | File "/usr/local/lib/python3.11/dist-packages/django/utils/connection.py", line 15, in __getattr__
executions-worker_1 | return getattr(self._connections[self._alias], item)
executions-worker_1 | ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
executions-worker_1 | File "/usr/local/lib/python3.11/dist-packages/django/utils/connection.py", line 62, in __getitem__
executions-worker_1 | conn = self.create_connection(alias)
executions-worker_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
executions-worker_1 | File "/usr/local/lib/python3.11/dist-packages/django/db/utils.py", line 204, in create_connection
executions-worker_1 | backend = load_backend(db['ENGINE'])
executions-worker_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^
executions-worker_1 | File "/usr/local/lib/python3.11/dist-packages/django/db/utils.py", line 111, in load_backend
executions-worker_1 | return import_module('%s.base' % backend_name)
executions-worker_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
executions-worker_1 | File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
executions-worker_1 | return _bootstrap._gcd_import(name[level:], package, level)
executions-worker_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
executions-worker_1 | File "/usr/local/lib/python3.11/dist-packages/django/db/backends/postgresql/base.py", line 25, in <module>
executions-worker_1 | import psycopg2 as Database
executions-worker_1 | File "/usr/local/lib/python3.11/dist-packages/psycopg2/__init__.py", line 51, in <module>
executions-worker_1 | from psycopg2._psycopg import ( # noqa
executions-worker_1 | SystemError: initialization of _psycopg raised unreported exception
The executions-worker
uses the latest Python version, in this case 3.11
, that is incompatible with psycopg2 2.9.1
.