Skip to content

Commit

Permalink
fix(cli): align timezone between host and model container (#247)
Browse files Browse the repository at this point in the history
Because

- misalign timezone between host and model container when executing
`run`

This commit

- align timezone between host and model container by mounting timezone
configs
  • Loading branch information
heiruwu authored Dec 2, 2024
1 parent d08cf37 commit aa84a1c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
17 changes: 12 additions & 5 deletions instill/helpers/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,10 @@ def run(args):
"--shm-size=4gb",
"--name",
str(name),
"-v",
"/etc/timezone:/etc/timezone:ro",
"-v",
"/etc/localtime:/etc/localtime:ro",
f"{args.name}:{args.tag}",
"serve",
"run",
Expand All @@ -302,11 +306,14 @@ def run(args):
)
else:
subprocess.run(
f"docker run --rm -d --shm-size=4gb --name {str(name)} --gpus all {args.name}:{args.tag} /bin/bash -c \
\"serve build _model:entrypoint -o serve.yaml && \
sed -i 's/app1/default/' serve.yaml && \
sed -i 's/num_cpus: 0.0/num_gpus: 1.0/' serve.yaml && \
serve run serve.yaml\"",
f"docker run \
--rm -d --shm-size=4gb --name {str(name)} --gpus all \
-v /etc/timezone:/etc/timezone:ro -v /etc/localtime:/etc/localtime:ro \
{args.name}:{args.tag} /bin/bash -c \
\"serve build _model:entrypoint -o serve.yaml && \
sed -i 's/app1/default/' serve.yaml && \
sed -i 's/num_cpus: 0.0/num_gpus: 1.0/' serve.yaml && \
serve run serve.yaml\"",
shell=True,
check=True,
stdout=subprocess.DEVNULL,
Expand Down
2 changes: 1 addition & 1 deletion instill/helpers/init-templates/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ARG TARGET_ARCH_SUFFIX

FROM rayproject/ray:${RAY_VERSION}-py${PYTHON_VERSION}${CUDA_SUFFIX}${TARGET_ARCH_SUFFIX}

RUN sudo apt-get update && sudo apt-get install curl -y
RUN sudo apt-get update && sudo apt-get install tzdata curl vim -y

ARG SYSTEM_PACKAGES
RUN for package in ${SYSTEM_PACKAGES}; do \
Expand Down

0 comments on commit aa84a1c

Please sign in to comment.