Skip to content

Commit

Permalink
feat: wait_tcp.py to python3
Browse files Browse the repository at this point in the history
  • Loading branch information
yihong0618 committed Dec 30, 2021
1 parent a2529db commit dfbdb8d
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
10 changes: 5 additions & 5 deletions scripts/ci/wait_tcp.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# coding: utf-8

import socket
Expand All @@ -11,10 +11,10 @@ def tcp_ping(port, timeout):

while time.time() - now < timeout:
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(('0.0.0.0', port))
print("OK :{} is listening".format(port))
return
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
sock.connect(('0.0.0.0', port))
print("OK :{} is listening".format(port))
return
except:
print("not connected to :{}".format(port))
time.sleep(0.5)
Expand Down
18 changes: 9 additions & 9 deletions scripts/deploy/databend-query-cluster-3-nodes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ if [ "$mode" == "boot" ]; then
--log-dir ./_logs1 \
--raft-api-port 28103 \
&
python scripts/ci/wait_tcp.py --timeout 5 --port 9191
python3 scripts/ci/wait_tcp.py --timeout 5 --port 9191

nohup ./target/debug/databend-meta \
--id 2 \
Expand All @@ -55,7 +55,7 @@ if [ "$mode" == "boot" ]; then
--raft-api-port 28203 \
--join 127.0.0.1:28103 \
&
python scripts/ci/wait_tcp.py --timeout 5 --port 28202
python3 scripts/ci/wait_tcp.py --timeout 5 --port 28202

nohup ./target/debug/databend-meta \
--id 3 \
Expand All @@ -67,7 +67,7 @@ if [ "$mode" == "boot" ]; then
--raft-api-port 28303 \
--join 127.0.0.1:28103 \
&
python scripts/ci/wait_tcp.py --timeout 5 --port 28302
python3 scripts/ci/wait_tcp.py --timeout 5 --port 28302

else

Expand All @@ -83,7 +83,7 @@ else
--flight-api-address 0.0.0.0:9191 \
--log-dir ./_logs1 \
&
python scripts/ci/wait_tcp.py --timeout 5 --port 9191
python3 scripts/ci/wait_tcp.py --timeout 5 --port 9191

nohup ./target/debug/databend-meta \
--raft-dir "./_meta2" \
Expand All @@ -92,7 +92,7 @@ else
--flight-api-address 0.0.0.0:28202 \
--log-dir ./_logs2 \
&
python scripts/ci/wait_tcp.py --timeout 5 --port 28202
python3 scripts/ci/wait_tcp.py --timeout 5 --port 28202

nohup ./target/debug/databend-meta \
--raft-dir "./_meta3" \
Expand All @@ -101,26 +101,26 @@ else
--flight-api-address 0.0.0.0:28302 \
--log-dir ./_logs3 \
&
python scripts/ci/wait_tcp.py --timeout 5 --port 28302
python3 scripts/ci/wait_tcp.py --timeout 5 --port 28302

fi

echo 'Start DatabendQuery node-1'
nohup target/debug/databend-query -c scripts/deploy/config/databend-query-node-1.toml &

echo "Waiting on node-1..."
python scripts/ci/wait_tcp.py --timeout 5 --port 9091
python3 scripts/ci/wait_tcp.py --timeout 5 --port 9091

echo 'Start DatabendQuery node-2'
nohup target/debug/databend-query -c scripts/deploy/config/databend-query-node-2.toml &

echo "Waiting on node-2..."
python scripts/ci/wait_tcp.py --timeout 5 --port 9092
python3 scripts/ci/wait_tcp.py --timeout 5 --port 9092

echo 'Start DatabendQuery node-3'
nohup target/debug/databend-query -c scripts/deploy/config/databend-query-node-3.toml &

echo "Waiting on node-3..."
python scripts/ci/wait_tcp.py --timeout 5 --port 9093
python3 scripts/ci/wait_tcp.py --timeout 5 --port 9093

echo "All done..."
2 changes: 1 addition & 1 deletion scripts/deploy/databend-query-standalone-embedded-meta.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ BIN=${1:-debug}
echo 'Start DatabendQuery...'
nohup target/${BIN}/databend-query -c scripts/deploy/config/databend-query-embedded-meta.toml &
echo "Waiting on databend-query 10 seconds..."
python scripts/ci/wait_tcp.py --timeout 5 --port 3307
python3 scripts/ci/wait_tcp.py --timeout 5 --port 3307
4 changes: 2 additions & 2 deletions scripts/deploy/databend-query-standalone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ BIN=${1:-debug}
echo 'Start DatabendStore...'
nohup target/${BIN}/databend-meta --single --log-level=ERROR &
echo "Waiting on databend-meta 10 seconds..."
python scripts/ci/wait_tcp.py --timeout 5 --port 9191
python3 scripts/ci/wait_tcp.py --timeout 5 --port 9191

echo 'Start DatabendQuery...'
nohup target/${BIN}/databend-query -c scripts/deploy/config/databend-query-node-1.toml &
echo "Waiting on databend-query 10 seconds..."
python scripts/ci/wait_tcp.py --timeout 5 --port 3307
python3 scripts/ci/wait_tcp.py --timeout 5 --port 3307
2 changes: 1 addition & 1 deletion tests/perfs/compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def report(releaser, pull, files, type, current_log_link, ref_log_link):
f.close()


## python compare.py -r xxxx -p xxxx
## python3 compare.py -r xxxx -p xxxx
if __name__ == '__main__':
parser = ArgumentParser(description='databend perf results compare tools')
parser.add_argument('-r',
Expand Down

0 comments on commit dfbdb8d

Please sign in to comment.