Skip to content

Commit dfbdb8d

Browse files
committed
feat: wait_tcp.py to python3
1 parent a2529db commit dfbdb8d

File tree

5 files changed

+18
-18
lines changed

5 files changed

+18
-18
lines changed

scripts/ci/wait_tcp.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
# coding: utf-8
33

44
import socket
@@ -11,10 +11,10 @@ def tcp_ping(port, timeout):
1111

1212
while time.time() - now < timeout:
1313
try:
14-
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
15-
sock.connect(('0.0.0.0', port))
16-
print("OK :{} is listening".format(port))
17-
return
14+
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
15+
sock.connect(('0.0.0.0', port))
16+
print("OK :{} is listening".format(port))
17+
return
1818
except:
1919
print("not connected to :{}".format(port))
2020
time.sleep(0.5)

scripts/deploy/databend-query-cluster-3-nodes.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ if [ "$mode" == "boot" ]; then
4343
--log-dir ./_logs1 \
4444
--raft-api-port 28103 \
4545
&
46-
python scripts/ci/wait_tcp.py --timeout 5 --port 9191
46+
python3 scripts/ci/wait_tcp.py --timeout 5 --port 9191
4747

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

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

7272
else
7373

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

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

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

106106
fi
107107

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

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

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

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

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

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

126126
echo "All done..."

scripts/deploy/databend-query-standalone-embedded-meta.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ BIN=${1:-debug}
2121
echo 'Start DatabendQuery...'
2222
nohup target/${BIN}/databend-query -c scripts/deploy/config/databend-query-embedded-meta.toml &
2323
echo "Waiting on databend-query 10 seconds..."
24-
python scripts/ci/wait_tcp.py --timeout 5 --port 3307
24+
python3 scripts/ci/wait_tcp.py --timeout 5 --port 3307

scripts/deploy/databend-query-standalone.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ BIN=${1:-debug}
2121
echo 'Start DatabendStore...'
2222
nohup target/${BIN}/databend-meta --single --log-level=ERROR &
2323
echo "Waiting on databend-meta 10 seconds..."
24-
python scripts/ci/wait_tcp.py --timeout 5 --port 9191
24+
python3 scripts/ci/wait_tcp.py --timeout 5 --port 9191
2525

2626
echo 'Start DatabendQuery...'
2727
nohup target/${BIN}/databend-query -c scripts/deploy/config/databend-query-node-1.toml &
2828
echo "Waiting on databend-query 10 seconds..."
29-
python scripts/ci/wait_tcp.py --timeout 5 --port 3307
29+
python3 scripts/ci/wait_tcp.py --timeout 5 --port 3307

tests/perfs/compare.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ def report(releaser, pull, files, type, current_log_link, ref_log_link):
268268
f.close()
269269

270270

271-
## python compare.py -r xxxx -p xxxx
271+
## python3 compare.py -r xxxx -p xxxx
272272
if __name__ == '__main__':
273273
parser = ArgumentParser(description='databend perf results compare tools')
274274
parser.add_argument('-r',

0 commit comments

Comments
 (0)