Skip to content

Commit

Permalink
chore: improve gaianet start command
Browse files Browse the repository at this point in the history
Signed-off-by: Xin Liu <[email protected]>
  • Loading branch information
apepkuss committed Aug 15, 2024
1 parent 3e950cd commit a8bc020
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions gaianet
Original file line number Diff line number Diff line change
Expand Up @@ -1153,26 +1153,12 @@ start() {
check_node_url=$(awk -F'"' '/"check_node_url":/ {print $4}' $gaianet_base_dir/config.json)
# start assistant
export RUST_LOG=info
nohup gaias --socket-addr 0.0.0.0:$assistant_port --server-socket-addr 0.0.0.0:$llamaedge_port --server-log-file $gaianet_base_dir/log/start-llamaedge.log --target-url $check_node_url --log $gaianet_base_dir/log/assistant.log 2>&1 &
nohup gaias --socket-addr 0.0.0.0:$assistant_port --server-socket-addr 0.0.0.0:$llamaedge_port --server-log-file $gaianet_base_dir/log/start-llamaedge.log --target-url $check_node_url --log $gaianet_base_dir/log/assistant.log > /dev/null 2>&1 &
sleep 2
gaias_pid=$!
echo $gaias_pid > $gaianet_base_dir/gaias.pid
info " Server assistant started with pid: $gaias_pid"

# retrieve server info
info " Notify server info"
status_code=$(curl -o /dev/null -s -w "%{http_code}\n" \
-X GET http://localhost:$assistant_port/retrieve/info \
-H 'accept: application/json' \
-H 'Content-Type: application/json')
if [ "$status_code" -eq 200 ]; then
info " * The server info received."
elif [ "$status_code" -eq 500 ]; then
error " * Failed to send server information to $check_node_url"
else
error " * Failed to retrieve API Server info."
fi

# 4. start gaianet-domain
if [ "$local_only" -eq 0 ]; then
# start gaianet-domain
Expand All @@ -1193,6 +1179,21 @@ start() {
printf " The GaiaNet node is started in local mode at: http://localhost:$llamaedge_port\n\n"
fi

# 5. notify server info
sleep 2
info " Notify server info"
status_code=$(curl -o /dev/null -s -w "%{http_code}\n" \
-X GET http://localhost:$assistant_port/retrieve/info \
-H 'accept: application/json' \
-H 'Content-Type: application/json')
if [ "$status_code" -eq 200 ]; then
info " * The server info received."
elif [ "$status_code" -eq 500 ]; then
error " * Failed to send server information to $check_node_url"
else
error " * Failed to retrieve API Server info."
fi

info ">>> To stop the GaiaNet node, run the command: gaianet stop <<<"

exit 0
Expand Down

0 comments on commit a8bc020

Please sign in to comment.