-
Notifications
You must be signed in to change notification settings - Fork 16
feat: Add Pixi Docker example #38
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
feat: Add Pixi Docker example #38
Conversation
e31a1aa to
d7eb5f2
Compare
0e49408 to
22ee4ca
Compare
matthewfeickert
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
High-level comments for reviewers.
containers/pixi/mnist_gpu.sh
Outdated
| # As main.py is copied to the worker through transfer_input_files, it is not | ||
| # located in the same directory as the Pixi manifest (/app/pixi.toml). | ||
| # To avoid moving files around further or complicating the HTCondor submit | ||
| # description file have the command written out here instead of using a Pixi | ||
| # task. | ||
| time pixi run python ./main.py --epochs 20 --save-model |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just explaining why in the pixi/ example we can use the Pixi task runner system
templates-GPUs/pixi/mnist_gpu.sh
Line 33 in 8db14b2
| time pixi run train |
but here we give the command explicitly.
containers/pixi/mnist_gpu_docker.sub
Outdated
| universe = container | ||
| # To avoid excessive pulls, and potential rate limits, set as "missing" (default value) | ||
| docker_pull_policy = missing | ||
| container_image = docker://ghcr.io/<your github org>/templates-gpu:mnist-gpu-noble-cuda-12.9 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prepared such an image already, so if you want to test this you can use
container_image = docker://ghcr.io/matthewfeickert/templates-gpu:mnist-gpu-noble-cuda-12.9
containers/pixi/README.md
Outdated
| ``` | ||
|
|
||
| Note that this manual build and publish process is slow. | ||
| It is recommended to have this step be done through a continuous integration and continuous delivery (CI/CD) workflow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used the following GitHub Actions workflow to build my container image.
.github/workflows/docker.yml:
name: Docker Images
on:
push:
branches:
- main
tags:
- 'v*'
paths:
- 'containers/pixi/pixi.toml'
- 'containers/pixi/pixi.lock'
- 'containers/pixi/Dockerfile'
- 'containers/pixi/.dockerignore'
pull_request:
paths:
- 'containers/pixi/pixi.toml'
- 'containers/pixi/pixi.lock'
- 'containers/pixi/Dockerfile'
- 'containers/pixi/.dockerignore'
release:
types: [published]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions: {}
jobs:
docker:
name: Build and publish images
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Free disk space
uses: AdityaGarg8/remove-unwanted-software@v5
with:
remove-android: 'true'
remove-dotnet: 'true'
remove-haskell: 'true'
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# images: |
# ghcr.io/chtc/templates-gpu
images: |
ghcr.io/matthewfeickert/templates-gpu
# generate Docker tags based on the following events/attributes
tags: |
type=raw,value=mnist-gpu-noble-cuda-12.9
type=raw,value=latest
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Test build
id: docker_build_test
uses: docker/build-push-action@v6
with:
context: containers/pixi
file: containers/pixi/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
pull: true
- name: Deploy build
id: docker_build_deploy
uses: docker/build-push-action@v6
with:
context: containers/pixi
file: containers/pixi/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
pull: true
push: ${{ github.event_name != 'pull_request' }}I assumed that adding CI for this template repo isn't of interest, but if it is, I can add something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think that it's beyond the scope of this repo, but I think linking out to an example setup or general documentation is fine to plant some seeds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want the readme to point to #38 (comment) to plant that seed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@agitter I was going to point to https://carpentries-incubator.github.io/reproducible-ml-workflows/pixi-deployment.html#automation-with-github-actions-workflows. I have that staged, but haven't pushed yes as am waiting on clarification on #38 (comment).
Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be a better pointer than this thread
| > While this approach does work, as there is no shared file system cache that Pixi can leverage it is less efficient than building a Linux container with the Pixi environment and using a `container` universe job. | ||
| > Note also that as the jobs executable, `mnist_gpu.sh`, is installing all dependencies from a remote conda channel (conda-forge), multiple copies of the job should not be submitted to avoid intensive bandwidth demand. | ||
| > | ||
| > Look at the example in the [`containers/pixi`](https://github.com/CHTC/templates-GPUs/tree/master/containers/pixi) directory for the recommended approach for use of Pixi with HTCondor systems with no shared file system. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noting now that there is a more recommended approach using Linux containers.
|
This is ready for review now. Following #37 (comment), @iross @ChristinaLK, if you have any questions or comments let me know. 👍 (CHTC Office hours have been a bit difficult for me to call into lately given conflicting meetings, but I can try to join them if it helps to discuss anything.) |
31d2876 to
ffcadd4
Compare
|
👋 Ping to @iross @ChristinaLK for review. Also happy to close this and move things to https://github.com/CHTC/recipes depending on feedback on CHTC/recipes#29. |
ffcadd4 to
bd8dabe
Compare
|
(Rebase and force-push was from upgrading and relocking the environment — not necessary, but might as well keep this updated until merge.) |
|
cc @xamberl given CHTC/recipes#29 (comment) (thanks!). |
iross
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only thing I feel is really necessary before merge is an explanation of the entrypoint pieces with a beginner audience in mind.
|
|
||
| FROM ghcr.io/prefix-dev/pixi:noble AS build | ||
|
|
||
| # Redeclaring ARGS in a stage without a value inherits the global default |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This tripped me up for longer than I'd like to admit on something I was working on earlier this week 😆
containers/pixi/README.md
Outdated
| ``` | ||
|
|
||
| Note that this manual build and publish process is slow. | ||
| It is recommended to have this step be done through a continuous integration and continuous delivery (CI/CD) workflow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think that it's beyond the scope of this repo, but I think linking out to an example setup or general documentation is fine to plant some seeds.
* Add example of using a Pixi environment distributed in a Docker container
image.
- Link to 'Reproducible Machine Learning Workflows for Scientists'
Carpentries Incubator lesson for CI/CD workflow example.
* Add note in pixi/ example that the containers/pixi example provides a
recommended approach.
bd8dabe to
4800eaf
Compare
matthewfeickert
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some high-level notes for @iross following his review feedback. 👍
|
@iross just bumping this in 2026 as I know that I have a plethora of emails and GitHub notifications that have piled up in the liminal weeks at the end of 2025, and I assume you do as well. :P |
iross
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Resolves #36
pixi/example that thecontainers/pixiexample provides a recommended approach.Requires PR #37 to go in first.