[00:53:19] hi, i'm trying to migrate my telegram-wikilinksbot service from the old `jstart` stuff to the new `toolforge` stuff [00:53:54] is this the right channel for this question, btw? [00:54:52] i guess so, going off mw:Help:Toolforge [00:55:41] okay, so i've set up a run.sh with the command i used to use before: `my_venv/bin/python3 wikilinksbot.py` [00:56:38] this works when i just do `./run.sh` inside the ssh session, but it doesn't when i use it with `toolforge jobs run wikilinksbot --command ./run.sh --image bullseye --continuous` [00:57:19] any idea what i'm doing wrong? should the command in `run.sh` have a more specific path, perhaps? [01:09:17] what kind of error do you get? [01:09:34] there should be a wikilinksbot.err file iirc [01:10:15] oh wait – if it's Python you probably want a python-something image, the plain bullseye one might not be enough [01:14:33] oh, there's a section here i hadn't noticed: https://wikitech.wikimedia.org/wiki/News/Toolforge_Stretch_deprecation#Rebuild_virtualenv_for_python_users [01:14:37] will give that a try [01:16:34] yeah, rebuilding is probably a good idea too [01:16:58] (or just use a different venv / build it in run.sh maybe) [01:22:21] Job name: Job type: Status: [01:22:21] ------------ ----------- ------------------------------ [01:22:23] wikilinksbot continuous Specified command fails to run [01:22:37] (but again, just run.sh on its own works as expected) [01:55:11] alright, i found the actual error in the .err file: [01:55:12] ModuleNotFoundError: No module named 'telegram' [01:55:14] [01:55:15] Even though it's supposed to be running inside the virtual environment specifically created to install that module 🤔 [11:01:39] I’m confused by how the `run.sh` even reaches any Python code if the command is `.././venv/bin/python3` [11:02:07] I would expect the working directory to be the tool home directory, in which case that path doesn’t resolve [11:06:57] @jhsoby: python virtual envs are linked to the environment in which they were created in. so if it works on a bastion, that usually means it was created on a bastion and won't work in a kubernetes-based job. see https://wikitech.wikimedia.org/wiki/Help:Toolforge/Python#Virtual_environments [11:07:00] which image did you end up using? I can’t see it anywhere [11:07:23] the 'ModuleNotFoundError' error is also a sign that the venv is being used in an environment it was not created in [11:08:13] I tried with both python images too, same result (re @lucaswerkmeister: which image did you end up using? I can’t see it anywhere) [11:09:13] I’m assuming you mean python3.9 and python3.11? (those are the ones I can see in `toolforge jobs images`) [11:09:17] Yeah, i created a new venv to test with, but I probably did it incorrectly (re @wmtelegram_bot: @jhsoby: python virtual envs are linked to the environment in which they were created in. so if it works on a bastion, t...) [11:09:19] neither of those could work, the venv is a python3.7 one [11:09:25] Yes (re @lucaswerkmeister: I’m assuming you mean python3.9 and python3.11? (those are the ones I can see in toolforge jobs images)) [11:10:09] Makes sense. I also noticed that, but at that point it was too late for me brain to fully process it 😜 (re @lucaswerkmeister: neither of those could work, the venv is a python3.7 one) [11:11:48] I think creating the venv in run.sh is probably the safest way to ensure it’s compatible, I do something similar in the quickcategories background runner https://github.com/lucaswerkmeister/tool-quickcategories/blob/d817ca5f60ba3d3ae9303acf0eced31caabfe231/deployment.yaml#L29 [11:12:10] but using a `webservice shell` probably also works as long as you use the kubernetes backend and the right webservice type (with the right python version) [13:16:51] !log tools.lexeme-forms deployed 442f510a5b (German neuter noun Wikifunctions) [13:16:54] Logged the message at https://wikitech.wikimedia.org/wiki/Nova_Resource:Tools.lexeme-forms/SAL [15:04:14] !log tools.lexeme-forms deployed 11e7d12745 (one more set of German neuter noun Wikifunctions) [15:04:18] Logged the message at https://wikitech.wikimedia.org/wiki/Nova_Resource:Tools.lexeme-forms/SAL [16:36:17] !log tools.lexeme-forms deployed 0416376e58 (German masculine noun Wikifunctions) [16:36:21] Logged the message at https://wikitech.wikimedia.org/wiki/Nova_Resource:Tools.lexeme-forms/SAL [20:25:55] !log tools.pbbot Restart webservice to solve 'no class def found' error [20:25:58] Logged the message at https://wikitech.wikimedia.org/wiki/Nova_Resource:Tools.pbbot/SAL [23:54:29] i'm trying a similar approach now, and again it works when i just run ./run.sh, but fails (with "Specified command fails to run") when i do it with `toolforge jobs run` 😩 (re @lucaswerkmeister: I think creating the venv in run.sh is probably the safest way to ensure it’s compatible, I do something similar in the quickcat...) [23:54:57] so maybe my paths are wrong? [23:57:29] it looks like you’re still using the `bullseye` image, it should probably be one of the python ones