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

python venv: create utility script #8437

Closed
2 tasks
FreddieAkeroyd opened this issue Jul 16, 2024 · 1 comment
Closed
2 tasks

python venv: create utility script #8437

FreddieAkeroyd opened this issue Jul 16, 2024 · 1 comment
Assignees
Labels

Comments

@FreddieAkeroyd
Copy link
Member

FreddieAkeroyd commented Jul 16, 2024

On of our Jenkins jobs running python wiki checks crashed, analysis of system log indicated it was actually running python from the network and there must have been a network break meaning system lost contact with running executable, on windows this is an issue as the exe/dll are not cached locally but paged over the network.

See https://github.com/ISISComputingGroup/ibex_wiki_checker/blob/master/run_tests.bat for an example of how a venv is currently created. The jobs currently use the https://github.com/ISISComputingGroup/ibex_utils/blob/master/installation_and_upgrade/define_latest_genie_python.bat script to assign a network build of python, then create a venv and activate it. I was suspicious that the venv had no python DLLs etc in it, it seems venv python.exe just launches the original exe from the network (just look at task manager!). So though you have a separate site-packages etc. you are still vulnerable to network breaks.

acceptance criteria

  • a separate utils script is created for building a python venv which can be used instead of separate logic that we often embed in multiple places (like in example above).
  • This utils script should run a venv that is network independent (is this possible via different options?). If this is not possible, we may need to create a separate sort of installable venv on the network as part of the genie python build i.e. a genie python package without all its additional site-packages additions. Our current genie python starts as an unzipped clean python, so we just need to deploy this somewhere separately and add a script to copy it locally e.g. an install_clean_python we can then either use this directly, or proceed to venv but at least knowing all exe/dll will be local

Time in Planning

1:52:10 18/07/24
00:25:15 08/08/24

@jackbdoughty
Copy link
Contributor

jackbdoughty commented Sep 2, 2024

I did this by changing the define_latest_genie_python.bat in IBEX Utils so that when called it installs python under a temporary directory and then sets the global variables. The venv is then created using this local install of python. And then all files referencing define_latest_genie_python.bat are responsible for calling remove_genie_python.bat to remove the installation and unassign the variables. Merge IBEX Utils before other PRs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Status: No status
Development

No branches or pull requests

6 participants