Skip to content

Commit 31104aa

Browse files
develop
Signed-off-by: Yicheng-Lu-llll <[email protected]>
1 parent 2239968 commit 31104aa

File tree

3 files changed

+47
-23
lines changed

3 files changed

+47
-23
lines changed

Dockerfile

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,9 @@
1-
ARG PYTHON_VERSION
2-
FROM python:${PYTHON_VERSION}-slim-buster
3-
4-
MAINTAINER Flyte Team <[email protected]>
5-
LABEL org.opencontainers.image.source https://github.com/flyteorg/flytekit
6-
1+
FROM python:3.9-slim-buster
2+
USER root
73
WORKDIR /root
84
ENV PYTHONPATH /root
9-
10-
ARG VERSION
11-
ARG DOCKER_IMAGE
12-
135
RUN apt-get update && apt-get install build-essential -y
14-
15-
# Pod tasks should be exposed in the default image
16-
RUN pip install -U flytekit==$VERSION \
17-
flytekitplugins-pod==$VERSION \
18-
flytekitplugins-deck-standard==$VERSION \
19-
flytekitplugins-envd==$VERSION \
20-
scikit-learn
21-
22-
RUN useradd -u 1000 flytekit
23-
RUN chown flytekit: /root
24-
USER flytekit
25-
26-
ENV FLYTE_INTERNAL_IMAGE "$DOCKER_IMAGE"
6+
RUN apt-get install git -y
7+
RUN pip install -U git+https://github.com/Yicheng-Lu-llll/flytekit.git@"visualization#egg=flytekitplugins-deck-standard&subdirectory=plugins/flytekit-deck-standard"
8+
RUN pip install -U git+https://github.com/Yicheng-Lu-llll/flytekit.git@real-time-deck-support
9+
ENV FLYTE_INTERNAL_IMAGE "localhost:30000/flytekit:demo"

build-image.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Step1: Ensure you have pushed your changes to the remote repo
2+
# In the flytekit folder
3+
git add . && git commit -s -m "develop" && git push
4+
5+
# Step2: Build the image
6+
# In the flytekit folder
7+
export FLYTE_INTERNAL_IMAGE="localhost:30000/flytekit:demo"
8+
docker build --no-cache -t "${FLYTE_INTERNAL_IMAGE}" -f ./Dockerfile .
9+
10+
# Step3: Push the image to the Flyte Cluster
11+
docker push ${FLYTE_INTERNAL_IMAGE}
12+
13+
# Step4: Submit a hello world workflow to the Flyte Cluster
14+
15+
pyflyte run --image ${FLYTE_INTERNAL_IMAGE} --remote ./test.py wf

test.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import flytekit
2+
from flytekit import Resources, task, workflow
3+
from flytekit.core.utils import timeit
4+
5+
@task(
6+
disable_deck=False,
7+
limits=Resources(mem="4Gi", cpu="1"),
8+
)
9+
def t1():
10+
import time
11+
12+
for i in range(2):
13+
# timeit measure the time used in the block and shown in time line deck. See https://github.com/flyteorg/flytekit/pull/1581.
14+
# Or you can add information to your own deck. See https://docs.flyte.org/projects/cookbook/en/latest/auto/core/flyte_basics/deck.html.
15+
with timeit(f"iteration {i}"):
16+
time.sleep(50)
17+
flytekit.Deck.persist()
18+
19+
20+
@workflow
21+
def wf():
22+
t1()
23+
24+
25+
if __name__ == "__main__":
26+
wf()

0 commit comments

Comments
 (0)