Skip to content

Commit

Permalink
develop
Browse files Browse the repository at this point in the history
Signed-off-by: Yicheng-Lu-llll <[email protected]>
  • Loading branch information
Yicheng-Lu-llll committed Jun 29, 2023
1 parent 2239968 commit 31104aa
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 23 deletions.
29 changes: 6 additions & 23 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,9 @@
ARG PYTHON_VERSION
FROM python:${PYTHON_VERSION}-slim-buster

MAINTAINER Flyte Team <[email protected]>
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"
15 changes: 15 additions & 0 deletions build-image.sh
Original file line number Diff line number Diff line change
@@ -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
26 changes: 26 additions & 0 deletions test.py
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit 31104aa

Please sign in to comment.