canonical / kserve-rocks

ROCKs for Kserve
0 stars 1 forks source link

add sklearnserver rock #23

Closed ca-scribner closed 7 months ago

ca-scribner commented 7 months ago

adds a rock for the kserve v0.11 sklearnserver based on this dockerfile and the existing Paddle and pmmlserver rocks

This PR refactors a little compared to the previous rocks like pmmlserver. The main goals were:

Specifically for the pythonpath, the pmmlserver rock needs to add /pmmlserver:/kserve to its service PYTHONPATH because poetry by default installs a root project as editable, which means the code is not stored in dist-packages like the other installed packages. So when we copy our installed python packages from build env to the final rock in pmmlserver, we omit the pmmlserver and kserve packages (and then we "fix" that by copying the code separately, and adding the new code dirs to PYTHONPATH.

I'm worried this PYTHONPATH workaround might have unintended consequences, so instead in this rock I install kserve and sklearnserver packages as local dependencies of a dummy poetry project rather than as root projects. This tricks poetry into installing them normally (not editable), which means they are put in dist-packages like everything else.

Testing instructions

cd sklearnserver
rockcraft pack
sudo skopeo --insecure-policy copy oci-archive:sklearnserver_0.11.0_amd64.rock docker-daemon:charmedkubeflow/sklearnserver:0.11.0
docker run charmedkubeflow/sklearnserver:0.11.0

The rock should launch, but then fail with:

2024-02-15T20:42:59.351Z [sklearnserver] main.py: error: the following arguments are required: --model_dir

ca-scribner commented 7 months ago

PR is missing the tox.ini/tests folder. will add these next before merging this. But the rock itself works afaict in local testing

ca-scribner commented 7 months ago

PR is now ready for review, with proper tests. Any CI failures now are not intentional