From 31104aa75e598774885c792aaa0c07096e19ce24 Mon Sep 17 00:00:00 2001 From: Yicheng-Lu-llll Date: Thu, 29 Jun 2023 02:23:39 +0000 Subject: [PATCH] develop Signed-off-by: Yicheng-Lu-llll --- Dockerfile | 29 ++++++----------------------- build-image.sh | 15 +++++++++++++++ test.py | 26 ++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 23 deletions(-) create mode 100755 build-image.sh create mode 100644 test.py diff --git a/Dockerfile b/Dockerfile index 257fcb5143c..24e7069e9a4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,26 +1,9 @@ -ARG PYTHON_VERSION -FROM python:${PYTHON_VERSION}-slim-buster - -MAINTAINER Flyte Team -LABEL org.opencontainers.image.source https://github.com/flyteorg/flytekit - +FROM python:3.9-slim-buster +USER root WORKDIR /root ENV PYTHONPATH /root - -ARG VERSION -ARG DOCKER_IMAGE - RUN apt-get update && apt-get install build-essential -y - -# Pod tasks should be exposed in the default image -RUN pip install -U flytekit==$VERSION \ - flytekitplugins-pod==$VERSION \ - flytekitplugins-deck-standard==$VERSION \ - flytekitplugins-envd==$VERSION \ - scikit-learn - -RUN useradd -u 1000 flytekit -RUN chown flytekit: /root -USER flytekit - -ENV FLYTE_INTERNAL_IMAGE "$DOCKER_IMAGE" +RUN apt-get install git -y +RUN pip install -U git+https://github.com/Yicheng-Lu-llll/flytekit.git@"visualization#egg=flytekitplugins-deck-standard&subdirectory=plugins/flytekit-deck-standard" +RUN pip install -U git+https://github.com/Yicheng-Lu-llll/flytekit.git@real-time-deck-support +ENV FLYTE_INTERNAL_IMAGE "localhost:30000/flytekit:demo" \ No newline at end of file diff --git a/build-image.sh b/build-image.sh new file mode 100755 index 00000000000..27cba2c4120 --- /dev/null +++ b/build-image.sh @@ -0,0 +1,15 @@ +# Step1: Ensure you have pushed your changes to the remote repo +# In the flytekit folder +git add . && git commit -s -m "develop" && git push + +# Step2: Build the image +# In the flytekit folder +export FLYTE_INTERNAL_IMAGE="localhost:30000/flytekit:demo" +docker build --no-cache -t "${FLYTE_INTERNAL_IMAGE}" -f ./Dockerfile . + +# Step3: Push the image to the Flyte Cluster +docker push ${FLYTE_INTERNAL_IMAGE} + +# Step4: Submit a hello world workflow to the Flyte Cluster + +pyflyte run --image ${FLYTE_INTERNAL_IMAGE} --remote ./test.py wf diff --git a/test.py b/test.py new file mode 100644 index 00000000000..c7e7d20cb59 --- /dev/null +++ b/test.py @@ -0,0 +1,26 @@ +import flytekit +from flytekit import Resources, task, workflow +from flytekit.core.utils import timeit + +@task( + disable_deck=False, + limits=Resources(mem="4Gi", cpu="1"), +) +def t1(): + import time + + for i in range(2): + # timeit measure the time used in the block and shown in time line deck. See https://github.com/flyteorg/flytekit/pull/1581. + # Or you can add information to your own deck. See https://docs.flyte.org/projects/cookbook/en/latest/auto/core/flyte_basics/deck.html. + with timeit(f"iteration {i}"): + time.sleep(50) + flytekit.Deck.persist() + + +@workflow +def wf(): + t1() + + +if __name__ == "__main__": + wf()