Skip to content

Commit 7729d2a

Browse files
committed
add cuda fallback to pixi template
1 parent 715e509 commit 7729d2a

4 files changed

Lines changed: 40 additions & 0 deletions

File tree

src/main/resources/templates/conda-pixi-v1/dockerfile-conda-file.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ WORKDIR /opt/wave
55

66
RUN pixi init --import /opt/wave/conda.yml \
77
{{base_packages}}
8+
&& (pixi install > /tmp/pixi.log 2>&1 \
9+
&& cat /tmp/pixi.log \
10+
|| (cat /tmp/pixi.log >&2 && grep -q __cuda /tmp/pixi.log \
11+
&& CONDA_OVERRIDE_CUDA="99" pixi install)) \
812
&& pixi shell-hook > /shell-hook.sh \
913
&& echo 'exec "$@"' >> /shell-hook.sh \
1014
&& echo ">> CONDA_LOCK_START" \

src/main/resources/templates/conda-pixi-v1/singularityfile-conda-file.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ From: {{pixi_image}}
66
mkdir /opt/wave && cd /opt/wave
77
pixi init --import /scratch/conda.yml
88
{{base_packages}}
9+
pixi install > /tmp/pixi.log 2>&1 \
10+
&& cat /tmp/pixi.log \
11+
|| (cat /tmp/pixi.log >&2 && grep -q __cuda /tmp/pixi.log \
12+
&& CONDA_OVERRIDE_CUDA="99" pixi install)
913
pixi shell-hook > /shell-hook.sh
1014
echo ">> CONDA_LOCK_START"
1115
cat /opt/wave/pixi.lock

src/test/groovy/io/seqera/wave/util/ContainerHelperTest.groovy

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,10 @@ class ContainerHelperTest extends Specification {
635635
636636
RUN pixi init --import /opt/wave/conda.yml \\
637637
&& pixi add conda-forge::procps-ng \\
638+
&& (pixi install > /tmp/pixi.log 2>&1 \\
639+
&& cat /tmp/pixi.log \\
640+
|| (cat /tmp/pixi.log >&2 && grep -q __cuda /tmp/pixi.log \\
641+
&& CONDA_OVERRIDE_CUDA="99" pixi install)) \\
638642
&& pixi shell-hook > /shell-hook.sh \\
639643
&& echo 'exec "$@"' >> /shell-hook.sh \\
640644
&& echo ">> CONDA_LOCK_START" \\
@@ -687,6 +691,10 @@ class ContainerHelperTest extends Specification {
687691
688692
RUN pixi init --import /opt/wave/conda.yml \\
689693
&& pixi add foo::one bar::two \\
694+
&& (pixi install > /tmp/pixi.log 2>&1 \\
695+
&& cat /tmp/pixi.log \\
696+
|| (cat /tmp/pixi.log >&2 && grep -q __cuda /tmp/pixi.log \\
697+
&& CONDA_OVERRIDE_CUDA="99" pixi install)) \\
690698
&& pixi shell-hook > /shell-hook.sh \\
691699
&& echo 'exec "$@"' >> /shell-hook.sh \\
692700
&& echo ">> CONDA_LOCK_START" \\

src/test/groovy/io/seqera/wave/util/TemplateUtilsTest.groovy

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,10 @@ class TemplateUtilsTest extends Specification {
359359
360360
RUN pixi init --import /opt/wave/conda.yml \\
361361
&& pixi add foo::bar \\
362+
&& (pixi install > /tmp/pixi.log 2>&1 \\
363+
&& cat /tmp/pixi.log \\
364+
|| (cat /tmp/pixi.log >&2 && grep -q __cuda /tmp/pixi.log \\
365+
&& CONDA_OVERRIDE_CUDA="99" pixi install)) \\
362366
&& pixi shell-hook > /shell-hook.sh \\
363367
&& echo 'exec "$@"' >> /shell-hook.sh \\
364368
&& echo ">> CONDA_LOCK_START" \\
@@ -394,6 +398,10 @@ class TemplateUtilsTest extends Specification {
394398
395399
RUN pixi init --import /opt/wave/conda.yml \\
396400
&& pixi add conda-forge::procps-ng \\
401+
&& (pixi install > /tmp/pixi.log 2>&1 \\
402+
&& cat /tmp/pixi.log \\
403+
|| (cat /tmp/pixi.log >&2 && grep -q __cuda /tmp/pixi.log \\
404+
&& CONDA_OVERRIDE_CUDA="99" pixi install)) \\
397405
&& pixi shell-hook > /shell-hook.sh \\
398406
&& echo 'exec "$@"' >> /shell-hook.sh \\
399407
&& echo ">> CONDA_LOCK_START" \\
@@ -432,6 +440,10 @@ class TemplateUtilsTest extends Specification {
432440
433441
RUN pixi init --import /opt/wave/conda.yml \\
434442
&& pixi add conda-forge::procps-ng \\
443+
&& (pixi install > /tmp/pixi.log 2>&1 \\
444+
&& cat /tmp/pixi.log \\
445+
|| (cat /tmp/pixi.log >&2 && grep -q __cuda /tmp/pixi.log \\
446+
&& CONDA_OVERRIDE_CUDA="99" pixi install)) \\
435447
&& pixi shell-hook > /shell-hook.sh \\
436448
&& echo 'exec "$@"' >> /shell-hook.sh \\
437449
&& echo ">> CONDA_LOCK_START" \\
@@ -666,6 +678,10 @@ class TemplateUtilsTest extends Specification {
666678
mkdir /opt/wave && cd /opt/wave
667679
pixi init --import /scratch/conda.yml
668680
pixi add conda-forge::procps-ng
681+
pixi install > /tmp/pixi.log 2>&1 \\
682+
&& cat /tmp/pixi.log \\
683+
|| (cat /tmp/pixi.log >&2 && grep -q __cuda /tmp/pixi.log \\
684+
&& CONDA_OVERRIDE_CUDA="99" pixi install)
669685
pixi shell-hook > /shell-hook.sh
670686
echo ">> CONDA_LOCK_START"
671687
cat /opt/wave/pixi.lock
@@ -686,6 +702,10 @@ class TemplateUtilsTest extends Specification {
686702
mkdir /opt/wave && cd /opt/wave
687703
pixi init --import /scratch/conda.yml
688704
pixi add conda-forge::procps-ng
705+
pixi install > /tmp/pixi.log 2>&1 \\
706+
&& cat /tmp/pixi.log \\
707+
|| (cat /tmp/pixi.log >&2 && grep -q __cuda /tmp/pixi.log \\
708+
&& CONDA_OVERRIDE_CUDA="99" pixi install)
689709
pixi shell-hook > /shell-hook.sh
690710
echo ">> CONDA_LOCK_START"
691711
cat /opt/wave/pixi.lock
@@ -712,6 +732,10 @@ class TemplateUtilsTest extends Specification {
712732
%post
713733
mkdir /opt/wave && cd /opt/wave
714734
pixi init --import /scratch/conda.yml
735+
pixi install > /tmp/pixi.log 2>&1 \\
736+
&& cat /tmp/pixi.log \\
737+
|| (cat /tmp/pixi.log >&2 && grep -q __cuda /tmp/pixi.log \\
738+
&& CONDA_OVERRIDE_CUDA="99" pixi install)
715739
pixi shell-hook > /shell-hook.sh
716740
echo ">> CONDA_LOCK_START"
717741
cat /opt/wave/pixi.lock

0 commit comments

Comments
 (0)