Hello,
I am still a bit stuck with my worker. It worked briefly last week, but I
suspect that my environment was not consistent. I suppose the source of my
problems is my bad understanding of the virtual environment (see also my
email last week about python 3.5 and 3.7), and of the "root" path. Today, I
cleaned everything and started from scratch (for the 10th time :/). I made
some observations that are not clear to me. As a recall, my website uses
django and has a celery/redis worker.
*Try 1: following*
https://wikitech.wikimedia.org/wiki/Help:Toolforge/Web/Python
So I install the venv using "webservice --backend=kubernetes python3.7
shell", which means using the interactive pod. When I am in the interactive
pod, with venv activated, kubectl is not found (bash: kubectl: command not
found). The packages are however found, for instance "celery" in the shell
returns no error. It is also possible to migrate the app. There is a folder
venv/lib/python3.7... There is a celery and a django folder inside. Then if
I "exit out of webservice shell" and re-activate the venv. Kubectl is
found, but celery sends me:
Traceback (most recent call last):
File "/data/project/cycling-init-bot/www/python/venv/bin/celery", line 5,
in <module>
from celery.__main__ import main
ImportError: No module named 'celery'
If I go to www/python/src (or don't actually) and try to migrate, I get:
Traceback (most recent call last):
File "manage.py", line 10, in main
from django.core.management import execute_from_command_line
ImportError: No module named 'django'
The "webservice --backend=kubernetes python3.7 start", works.
So I don't quite understand what are the discrepancies between interactive
and normal pod. We install things in one context but then they are not
found in the other one... Shall I do something with the PYTHONPATH maybe?
*Try 2: without interactive*
Now I don't use interactive at all. When typing "python3 -m venv
$HOME/www/python/venv". It creates a python3.5 venv (lib/python3.5/). In
this case, celery command and migrations works. However by starting the
webservice "webservice --backend=kubernetes python3.5 start", I get in
uwsgi.logs
*** Operational MODE: preforking ***
mounting /data/project/cycling-init-bot/www/python/src/app.py on
/cycling-init-bot
Traceback (most recent call last):
File "/data/project/cycling-init-bot/www/python/src/app.py", line 5, in
<module>
from django.core.wsgi import get_wsgi_application
ModuleNotFoundError: No module named 'django'
For try 1 and try 2, the worker didn't start (python image version was
adapted/variated, it changed this time nothing). As kubectl logs is empty
and the describe deployment gives no information, it is quite difficult to
describe what happens. I noticed that
https://github.com/Wikidata/editgroups uses
a separate venv at the root of the project for celery.
Psemdel