Skip to content

Commit

Permalink
Backend - Fixed handling of sample compilation failure (#387)
Browse files Browse the repository at this point in the history
* Backend - Fixed handling of sample compilation failure

* Update Dockerfile

* Fixed the pipeline enumeration with "while read" loop.
  • Loading branch information
Ark-kun authored and k8s-ci-robot committed Nov 28, 2018
1 parent 42ccde1 commit 2a3ec15
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion backend/Dockerfile
Expand Up @@ -31,7 +31,16 @@ RUN pip3 install /kfp.tar.gz

WORKDIR /samples
COPY ./samples .
RUN find . -maxdepth 2 -name "*.py" -exec dsl-compile --py {} --output {}.tar.gz \;

#We need to check that all samples have been compiled without error.
#For find program, the -exec argument is a filter predicate just like -name. It only affects whether the file is "found", not the find's exit code.
#One way to solve this problem is to check whether we have any python pipelines that cannot compile. Here the exit code is the number of such files:
#RUN bash -e -c 'exit $(find . -maxdepth 2 -name "*.py" ! -exec dsl-compile --py {} --output {}.tar.gz \; -print | wc -l)'
#I think it's better to just use a shell loop though.
#RUN for pipeline in $(find . -maxdepth 2 -name '*.py' -type f); do dsl-compile --py "$pipeline" --output "$pipeline.tar.gz"; done
#The "for" loop breaks on all whitespace, so we either need to override IFS or use the "read" command instead.
RUN find . -maxdepth 2 -name '*.py' -type f | while read pipeline; do dsl-compile --py "$pipeline" --output "$pipeline.tar.gz"; done


FROM alpine

Expand Down

0 comments on commit 2a3ec15

Please sign in to comment.