Commit Graph

163 Commits

Author SHA1 Message Date
pyranota
9c318c6fb9 nit: print more information in frontend if something goes wrong with uv (#5411)
* nit: print to frontend logs if there is fallback to system python

* print to logs if fallback
2025-03-04 00:36:11 +01:00
pyranota
ab95df4cc1 fix dedicated worker multipython (#5338)
* fix dedicated worker multipython

* fix typo

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>

* fix dedublicate logic

* fix ellipsis complaints

* more factorization

* pass slice instead of ref to vector

---------

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
2025-02-25 17:22:03 +01:00
Ruben Fiszel
19d23fb3f3 fix: add LOCALAPPDATA env variable to python execution on windows 2025-02-24 18:36:26 +01:00
Ruben Fiszel
6359838d31 initialize an uv venv globally but skip it for python executor 2025-02-22 01:53:14 +01:00
pyranota
8b6df77ce1 fix windows build (#5336) 2025-02-20 09:16:43 +01:00
Ruben Fiszel
50d75e358c fix: add proxy envs (http_proxy) to uv install 2025-02-20 03:10:09 +01:00
Ruben Fiszel
aacd0930fe fix(python): PYTHON_PATH overrides python from uv 2025-02-20 02:54:51 +01:00
pyranota
ba187a0953 fix windows build (#5333) 2025-02-20 00:26:09 +01:00
pyranota
c62728eaa9 feat: remove pip fallback option for python and ansible (#5186) 2025-02-19 17:33:11 +01:00
HugoCasa
88ae1dc990 feat: parse script for preprocessor/no_main_func on deploy (#5292)
* feat: parse script for preprocessor/no_main_func on deploy

* fix substitute for linux
2025-02-14 15:42:18 +01:00
Lucas Abel
6ded2c598e backend: use v2 tables through views where possible (v2 phase 3) (#5119) 2025-02-06 12:43:24 +01:00
Ruben Fiszel
9faa87483f delete proto file after install 2025-02-06 00:49:45 +01:00
Ruben Fiszel
098cd72840 fix uv install for nsjail (#5222) 2025-02-06 00:00:33 +01:00
Ruben Fiszel
908e6abee6 removing rw access to cache dir in uv pip install 2025-02-05 22:06:52 +01:00
Ruben Fiszel
dd3fb0f955 improve error messages for internal err 2025-02-05 16:32:01 +01:00
HugoCasa
378c3e4912 fix: preprocessor args python (#5210) 2025-02-04 23:34:03 +01:00
pyranota
f0bab9c1c0 fix(python): clear env before installing/finding python (#5209)
* fix(python): clear env before installing/finding python

* add windows-specific variables
2025-02-04 18:58:22 +01:00
pyranota
2b38000557 feat(python): make S3 cache arch specific (#5196)
* add .minio-data to .gitignore

* feat(python): make S3 cache arch specific

Current schema:

S3-Bucket
├── python_311
│   ├── wheel==1.0
│   └── wheel2==1.0
└── python_312
    ├── wheel==1.0
    └── wheel2==1.0

New schema:

S3-Bucket
├── linux_aarch64
│   └── ...
└── linux_x86_64
    ├── python_311
    │   ├── wheel==1.0
    │   └── wheel2==1.0
    └── python_312
        ├── wheel==1.0
        └── wheel2==1.0

* remove .minio-data from .gitignore

* remove unneeded tracing::error
2025-02-03 19:31:55 +01:00
pyranota
d27323e6d8 feat(python): add custom_wheels directory to PYTHONPATH (#5169)
* fix(python): fix uv can't find ssl certificates

- Add `PY_NATIVE_CERT` flag, forces UV to use native tls
- Rename `PIP_INDEX_CERT` to `PY_INDEX_CERT`
- Rename `PIP_TRUSTED_HOST` to `PY_TRUSTED_HOST`

For backwards compatibility PIP* variables are still accessible

* feat(python): add `custom_wheels` directory to PYTHONPATH

Add global directory by path `<CACHE_DIR>/python_xyz/custom_wheels`

For example for scripts running python 3.11, in every execution
`<CACHE_DIR>/python_311/custom_wheels` will be accessible and all wheels placed there could be imported and used.

This is usefull for preinstalling wheels before runtime

* Make it work with Nsjail

* Rework and make custom_wheels optional

* Remove `create_dir_all` from imports

* Use sync version of metadata

* Rename `custom_wheels` to `global-site-packages`
2025-01-29 19:13:47 +01:00
pyranota
0a252830bd fix(python): fix uv can't find ssl certificates (#5157)
- Add `PY_NATIVE_CERT` flag, forces UV to use native tls
- Rename `PIP_INDEX_CERT` to `PY_INDEX_CERT`
- Rename `PIP_TRUSTED_HOST` to `PY_TRUSTED_HOST`

For backwards compatibility PIP* variables are still accessible
2025-01-29 15:07:00 +01:00
pyranota
ba8add525b fix: Fix python refetching wheels from S3 (#5133) 2025-01-25 12:38:32 +01:00
pyranota
3af3fc898b feat(python): Multiple runtime versions (#4579)
* feat: Handle `pip install` by `uv`

Dirty and untested, but already something working

* Integrate with NSJAIL and prepare fallbacks

* Refactor fallback
no_uv disable compile and install
where no_uv_install and no_uv_compile are a bit more specific

* Remove `--disable-pip-version-check`
Reason:
   warning: pip's `--disable-pip-version-check` has no effect

* Fix backend compilation error

* Pip fallback overwrite UV's cache

* Initially refactor cache (No S3)

* Support S3

* Remove unused import

* Handle flags for NSJAIL

* Return deleted flag

* Remove verbose mode and enable link-mode=copy

* Granural migration of lockfiles

Before i realized we dont need it :)

* Initial draft (not-working)

* Add fallback

* Fix bug preventing uv from installing deps

'\n' - Love it

* Add verbosity indicator

* Iterate on feature
- Added instance python version
- Rework logic

* Fix EE build error
error[E0599]: no method named `iter` found for tuple `(PyVersion, std::vec::Vec<std::string::String>)` in the current scope

* Support S3

* Support NSJAIL

* Refactor `get_python`

* Make NSJAIL work [Unsafe]

config file missed /proc mount causing install phase to fail

* Trigger CI

* Clean up

* Make Actions build it

* Trigger CI #2

* Update Dockerfile and clean up

* Change fallbacks
now there is only no_uv and NOUV

* Expose INSTANCE_PYTHON_VERSION through env variable

* Change namings

* Include py-version to requirements.in

Also add comments and make code much cleaner

* Use const for python installation dir

It was hardcoded before

* Pin preinstalled version

* Update python_executor.rs

* Up to date branch

* Create PYCACHE dirs

TODO: PY_TAR_DIRS

* Fix after merge

* Make it safer

* Implement USE_SYSTEM_PYTHON

* Implement latest_stable option

* Load INSTANCE_PYTHON_VERSION on startup

* Check for multiple annotations used

* Fix Latest Stable button not pressed if selected

* Proper error handling for conflict on multiple annotations

* Fix merge conflicts

* Preinstall 3.11 and Latest Stable

* Preinstall latest stable in non-blocking manner

* Fix Warning

* Gate preinstall logic behind "python" feature

* Handle raw_deps properly

* Make it work with nsjail

* Revert docker-image.yml

* Revert Dockerfile

* Cleanup + Fixing

* Add windows support

---------

Co-authored-by: Ruben Fiszel <ruben@windmill.dev>
2025-01-24 11:42:48 +01:00
pyranota
a48f43499c fix(python): Replace Inf with null (#5099) 2025-01-20 19:38:35 +01:00
pyranota
aabf2a44cf fix: improve uv dependency install reliability with an atomic success file
* Revert solution with Mutex

* Implement valid.windmill logic

* Remove unused import

* valid.windmill -> .valid.windmill

Just like .lock

* Dont delete wheels if cancelled/failed

Now we dont clean up requirement folder if it was failed.

This way we can fully utilize uv's flock system.

Also if we left wheel dir, but it was partially filled (resulting to invalid wheel)
we use --reinstall flag in order to overwrite any content of wheels

* Add comment

* Add --reinstall to nsjail
2025-01-20 16:21:10 +01:00
Ruben Fiszel
6cd3381baa nits 2025-01-16 11:51:46 +01:00
pyranota
2d54356ddc fix(python): Cancel and Start again within 1s caused module not found [v2] (#5007)
* fix(python): Cancel installation and start again within 1s caused module not found

* fix(python): Fix uv install job not exiting on fail
Specifically with nmslib installation was hanging without any output, even tho library build was failed.

It can be monitored with strace or catp.

* Replace ofiles approach with mutex

* Small refactor

* Return space for consistency

* Revert incorrect fix

* Fix module not found

* Remove unused import
2025-01-03 16:09:24 +01:00
pyranota
9f44aadcf4 fix(windows&python): Access is denied. (os error 5) (#4969) 2024-12-23 16:25:01 +01:00
Ruben Fiszel
e5a6d68ce3 add proxy_envs to uv pip compile 2024-12-20 21:58:16 +01:00
Lucas Abel
dab7b39917 feat(cache): remove persistent raw values from queue (#4866)
* feat(cache): remove persistent raw values from queue

* test: add tests and fix discovered regressions

* fix csharp executor after rebase

* invalidate script cache after locking

* fix lite flow version race

* fix flow dependencies lock race

* update version flag to `v.1.440`
2024-12-16 17:10:16 +01:00
HugoCasa
95f4d15ffe more feature flags (#4918)
* more feature flags

* include python in tests

* smtp feature flag

* del

* add back file

* fix openapi int
2024-12-14 13:21:28 +01:00
pyranota
f43781f937 Display memory peak while installing wheels with uv (#4889)
* fix no_uv not affecting deploy

Before this fix no_uv, no_uv_compile and no_uv_install were not affecting Dependency jobs

These jobs are only affected if used USE_PIP_COMPILE or USE_PIP_INSTALL env variables

To make it more consistant, no_uv should also affect dep jobs.

Also make ansible use uv by default

* Make it build

* Add no_uv_usage stats

* Provide build-env for Samael through shell.nix

* Run update_sqlx.sh

* Update ee-repo-ref

* Display memory peak while installing wheels with uv

* Invert DISABLE_NSJAIL

* Make it safer

---------

Co-authored-by: Ruben Fiszel <ruben@windmill.dev>
2024-12-12 11:26:02 +01:00
pyranota
8526028a6f Add no_uv_usage stats (#4883)
* fix no_uv not affecting deploy

Before this fix no_uv, no_uv_compile and no_uv_install were not affecting Dependency jobs

These jobs are only affected if used USE_PIP_COMPILE or USE_PIP_INSTALL env variables

To make it more consistant, no_uv should also affect dep jobs.

Also make ansible use uv by default

* Make it build

* Add no_uv_usage stats

* Provide build-env for Samael through shell.nix

* Run update_sqlx.sh

* Update ee-repo-ref

* Update sqlx cache

* Update ee-repo-ref

* Update ee repo ref

* Update sqlx cache

* Update ee-repo-ref.txt
2024-12-12 00:32:03 +01:00
Ruben Fiszel
12d9a8525d clear env for uv pip-compile 2024-12-11 17:06:05 +01:00
Lucas Abel
ed71efa6da fmt: re-format Rust leftovers (#4897) 2024-12-11 08:57:00 +01:00
Ruben Fiszel
9bdb5dac9e handle empty requirement line in python 2024-12-10 16:40:12 +01:00
Ruben Fiszel
720d48d3a8 fix(python): do not follow symlinks when copying recursively in overlapping sites-package 2024-12-10 15:52:47 +01:00
Ruben Fiszel
f40fcf7b7e improve debug logs 2024-12-10 12:35:56 +01:00
Ruben Fiszel
2db7f07c87 add home in uv pip compile env 2024-12-09 20:53:43 +01:00
Ruben Fiszel
628ae617f7 feat: docker runtime 2024-12-09 18:02:18 +01:00
Ruben Fiszel
3f6e40b0d4 fix: pass USERPROFILE on windows 2024-12-05 10:12:44 +01:00
Ruben Fiszel
b81bf99cc2 prettify cache msg 2024-11-29 13:01:54 +01:00
Ruben Fiszel
6891bf604c nit pip install 2024-11-29 12:37:52 +01:00
Ruben Fiszel
1b74cbaebb add total time 2024-11-29 12:35:10 +01:00
Ruben Fiszel
e700016780 small uv s3 pull fix 2024-11-29 12:31:50 +01:00
Ruben Fiszel
8338efa685 skip s3 python cache on windows and pro 2024-11-29 08:35:08 +01:00
pyranota
a1dd641466 feat: Parallelize uv install (#4774)
* Implement MVP of Parallel uv installation

* Implement PY_CONCURRENT_DOWNLOADS

* Remove Flock for uv installs

* Make S3 pull/push parallel

* Refactor and allow to Cancel installation

* Dont print S3 in output if disabled

* Implement better error handling

* Polishing

* More polishing

* Implement error-handler for kill_tx_2.send()

* Fix and Format prev merge

* Presubscribe to all kill_tx's

We do it now before first event could fire
Meaning no events can be lost anymore

* Early print errors and safer error handling

* Return Err if installation failed

* Final changes

* Return error instead of just printing it

* Safer the way to acquire permit

* Fix compilation error

* Remove double error logs
2024-11-29 08:21:51 +01:00
pyranota
1323adb345 Remove flock (#4809) 2024-11-28 12:42:25 +01:00
pyranota
41c8a22830 fix(python): Merge to site-packages packages with same name (#4793)
* (python) Initially implement merge

Iterate overall all python paths and if same folder has same name multiple times,
then merge the content and put to <job_dir>/site-packages

Solves problem with imports for some dependencies.

Default layout (/windmill/cache/):

dep==x.y.z
└── X
   └── A
dep-ext==x.y.z
└── X
   └── B

In this case python would be confused with finding B module.

This function will convert it to (/<job_id>):

site-packages
└── X
   ├── A
   └── B

This way python has no problems with finding correct module

* Better error-handling

* Optimize and fix bug

* Update backend/windmill-worker/src/python_executor.rs

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>

* Update backend/windmill-worker/src/python_executor.rs

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>

* Polish

* Add path to PathBuf

* Add & before PathBuf

---------

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
2024-11-26 18:24:26 +01:00
Ruben Fiszel
cb39350ddc improve error messages on windows 2024-11-15 09:43:54 +01:00
Ruben Fiszel
bcf4c8d0bf nits logs 2024-11-15 01:15:51 +01:00