Page MenuHomePhabricator

Toolforge: Automatically identify when people are trying to launch a Python webservice with a venv created using the wrong Python version
Open, LowPublic


Our bastions are still on stretch which use Python 3.5, but most people are trying to launch Python 3.7 webservices on k8s. When creating the venv, you have to do it in a k8s interactive pod (see If you do it on the bastion, you'll end up with confusing "ModuleNotFound" style errors.

@bd808 suggested that we should be able to automatically detect these mismatches in webservice when you try to launch a new webservice.

Since the bastion is 3.5 and the venv should be 3.7, we could try to invoke ~/www/python/venv/bin/pip, which, if correctly created, should fail due to the missing module error.

I think it would be more reliable to simply check that ~/www/python/venv/bin/pip3.X exists for whatever 3.X version you're trying to launch a webservice in. This seems more future proof.

Event Timeline

Phamhi added a subscriber: Phamhi.

Checked documentation and can confirm that the steps are accurate.

Change 723761 had a related patch set uploaded (by Majavah; author: Majavah):

[operations/software/tools-webservice@master] Identify when venvs are for wrong Python versions

Change 723761 merged by jenkins-bot:

[operations/software/tools-webservice@master] Identify when venvs are for wrong Python versions

This was reverted earlier today as it did not work properly.

taavi removed taavi as the assignee of this task.Apr 4 2023, 7:55 PM