Skip to content

Commit

Permalink
robust status key parsing; "docker_ready" rename
Browse files Browse the repository at this point in the history
  • Loading branch information
sixbigsquare committed Sep 8, 2024
1 parent 416adbd commit 1cadf84
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions sky/provision/docker_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,21 +196,21 @@ def _check_host_status(self) -> dict:
if [[ $docker_installed -eq 1 ]]
then
# wait for docker daemon to be ready
docker_ready=0
docker_socket_ready=0
end_time=$((SECONDS + _docker_socket_wait_timeout_seconds))
while [ $SECONDS -lt $end_time ]; do
if {self.docker_cmd} info >/dev/null 2>&1; then
echo "docker_ready:" "Y"
docker_ready=1
echo "docker_socket_ready:" "Y"
docker_socket_ready=1
break
else
exec su -l $USER
sleep 5
fi
done
if [[ $docker_ready -eq 0 ]]
if [[ $docker_socket_ready -eq 0 ]]
then
echo "docker_ready:" "N"
echo "docker_socket_ready:" "N"
fi
# check runtime info
Expand Down Expand Up @@ -243,7 +243,12 @@ def _check_host_status(self) -> dict:
if k == 'MemAvailable':
k = 'mem_available_in_kb'
v = int(v.split()[0]) # type: ignore
ret[k] = v
if k in [
'docker_installed', 'docker_socket_ready',
'docker_runtime', 'container_status', 'container_image',
'mem_available_in_kb', 'status_checking_completed'
]: # robust parsing
ret[k] = v
return ret

def initialize(self) -> str:
Expand Down

0 comments on commit 1cadf84

Please sign in to comment.