Skip to content
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

feat: wait_tcp.py to python3 #3701

Merged
merged 1 commit into from
Dec 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the python3 command available in the major os environment like Darwin, ubuntu, fedora? q.q

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ubuntu and Darwin I think the answer yes

And I saw python3 command in dev_setup https://github.com/datafuselabs/databend/blob/main/scripts/setup/dev_setup.sh#L298

or maybe we can make the command from setup_dev too?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree, we can take the python commands the same among the script files

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

users env may have both python and python3 we can get the python env command in setup ln the python3 command.


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