-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#102] improvement: improve startup script #103
base: main
Are you sure you want to change the base?
Conversation
f13393f
to
68d5c63
Compare
Hi @unknowntpo, I've resolved the conflicts based on your recently merged PR #56. Would you please review this? If possible, I would appreciate if you could also test it in your environment. Thanks! |
@orenccl |
playground.sh
Outdated
docker run --pull always hello-world >/dev/null 2>&1 | ||
echo "[INFO] Testing Docker environment by running hello-world..." | ||
# Use always to test network connection | ||
docker run --rm --pull always hello-world:latest >/dev/null 2>&1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please specify hello-world
fixed tag, do not use latest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it.
playground.sh
Outdated
checkDockerDisk | ||
checkDockerRam | ||
checkDockerCpu | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this blank line.
playground.sh
Outdated
|
||
case "$runtime" in | ||
k8s) | ||
helm uninstall --namespace gravitino-playground gravitino-playground | ||
helm uninstall --namespace gravitino-playground gravitino-playground |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think need to add spaces in the line head, keep code sytle.
playground.sh
Outdated
skipChecks=false | ||
|
||
case "$3" in | ||
--skip-checks) | ||
skipChecks=true; | ||
;; | ||
-s) | ||
skipChecks=true; | ||
;; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need skipChecks
startup param? It feels too complicated.
I think we must check docker or k8s envorinments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the feedback. I'll remove the skipChecks parameter as suggested. The test didn't take much time, so this change should be straightforward.
hi @orenccl Thank you for your improve playground
|
44ee83f
to
852bd35
Compare
@xunliu I think letting user to run both k8s and docker is more handy. |
playground.sh
Outdated
|
||
testK8s() { | ||
echo "[INFO] Testing K8s environment..." | ||
kubectl cluster-info |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to check if there exists kubectl
first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
playground.sh
Outdated
@@ -64,140 +127,277 @@ checkHelm() { | |||
if [ $isExist ]; then | |||
true # Placeholder, do nothing | |||
else | |||
echo "ERROR: Helm command not found, Please install helm v3." | |||
echo "[ERROR] Helm check failed: Helm command not found, Please install helm v3." | |||
exit | |||
fi | |||
# check version | |||
# version will be like: | |||
# Version:"v3.15.2" | |||
regex="Version:\"(v[0-9]\.[0-9]+\.[0-9])\"" | |||
version=$(helm version) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we needs check if exist helm
first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section checks if Helm exists:
isExist=$(command -v helm)
if [ "$isExist" ]; then
I've unified the usage of which
and command -v
to use command -v
for consistent style.
if command -v helm >/dev/null 2>&1; then
playground.sh
Outdated
--set projectRoot=$(pwd) | ||
;; | ||
docker) | ||
logSuffix=$(date +%Y%m%d%H%m%s) | ||
docker-compose up --detach |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docker-compose
or docker compose
?
My macOS only have docker-compose
.
docker compose
is Linux OS?
Please check it.
Maybe you needs to check operation OS, and add different process.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not about the OS; it's about the Docker version. Newer versions of Docker have a built-in docker compose
command, whereas older versions do not. For older versions, you need to use docker-compose
, which is no longer being actively updated.
I added a function to automatically detect the appropriate Docker Compose command.
Reference:
Docker Compose Migration Guide
Update this PR: Please let me know if there are any problems. |
Hi @orenccl would you please rebase this PR to fix the conflicts? |
@orenccl Can you help check this issue when I ran the fileset example in jupyter? By the way ,we have 4 examples in jupyter, can you help verify them by access http://localhost:18888 ,especially k8s runtime. |
025cd68
to
9c324df
Compare
Hi @danhuawang, Sorry about this. I found that the commit Unified port number for Docker and Kubernetes actually caused some issues with internal communication within the Kubernetes cluster. This should be addressed in a separate issue, so I have reverted it and focused on the original problem. I've also updated the README to clarify the container and host port mapping, so users won't be confused about which port to forward. Could you review this when you have free time? |
playground.sh
Outdated
else | ||
echo "ERROR: There was an issue running kubectl cluster-info, please check you K8s cluster." | ||
# Check available space in the root partition if the directory doesn't exist (special case for WSL) | ||
availableSpaceKB=$(df --output=avail / | awk 'NR==2 {print $1}') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I encounter this issue when I launch with docker runtime. (MacOS)
df: unrecognized option `--output=avail'
usage: df [--libxo] [-b | -g | -H | -h | -k | -m | -P] [-acIilnY] [-,] [-T type] [-t type]
[file | filesystem ...]
./playground.sh: line 90: / 1024 / 1024: syntax error: operand expected (error token is "/ 1024 / 1024")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that macOS does not support --output=avail
. Refer to https://ss64.com/mac/df.html.
Instead of using --output=avail
, change it to -k
so that it works on both macOS and Linux. Refer to https://linuxcommand.org/lc3_man_pages/df1.html.
However, I don't have a macOS environment. Could you check this for me?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked macOS ,it's ok now.
playground.sh
Outdated
exit 1 | ||
fi | ||
|
||
case "${runtime}" in | ||
k8s) | ||
kubectl -n gravitino-playground get pods -o wide |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to replace hard code namespace with ${playgroundRuntimeName} like the helm install command in start method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
@orenccl conflicts need to be resolved. |
bcb81b6
to
6dd049a
Compare
@qqqttt123 Any comments? |
@xunliu |
I will update this PR soon since #110 has already been merged. |
6dd049a
to
122639c
Compare
@xunliu @danhuawang |
What changes were proposed in this pull request?
set -x
.cd "${playground_dir}" >/dev/null
tocd "${playground_dir}" >/dev/null || exit 1
to prevent failures whencd
fails.docker run --pull always hello-world >/dev/null 2>&1
todocker run --rm --pull always hello-world:latest >/dev/null 2>&1
to avoid pulling multiple images and ensure the container is removed after it finishes.--skip-checks
option for a quicker startup.%Y%m%d%H%m%s
to%Y%m%d%H%M%s
.Confirm the requirement is available in your OS [Y/n]:
.Why are the changes needed?
To improve the user experience.
close #102
Does this PR introduce any user-facing change?
Added a new option
--skip-checks|-s
for a quicker startup.How was this patch tested?
Tested with the following commands:
./playground start
./playground status
./playground stop
./playground start --skip-checks
./playground start -s
These tests were run to ensure the script works as intended.