forked from milvus-io/milvus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[test]Add rolling update test (milvus-io#22144)
Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com> Co-authored-by: Sheldon <chuanfeng.liu@zilliz.com>
- Loading branch information
1 parent
e5a6d90
commit 33de788
Showing
6 changed files
with
108 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
tests/python_client/deploy/scripts/breakdown_rolling_update.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import psutil | ||
import time | ||
from loguru import logger | ||
|
||
|
||
if __name__ == '__main__': | ||
import argparse | ||
parser = argparse.ArgumentParser(description='config for rolling update process') | ||
parser.add_argument('--wait_time', type=int, default=60, help='wait time after rolling update started') | ||
args = parser.parse_args() | ||
wait_time = args.wait_time | ||
logger.info("start to watch rolling update process") | ||
start_time = time.time() | ||
end_time = time.time() | ||
flag = False | ||
while not flag and end_time - start_time < 360: | ||
process_list = [p.info for p in psutil.process_iter(attrs=['pid', 'name','cmdline'])] | ||
for process in process_list: | ||
logger.debug(process) | ||
logger.debug("##"*30) | ||
for process in process_list: | ||
if isinstance(process.get("cmdline", []), list): | ||
cmdline_list = process.get("cmdline", []) | ||
for cmdline in cmdline_list: | ||
if "rollingUpdate.sh" in cmdline: | ||
logger.info(f"rolling update process: {process} started") | ||
flag = True | ||
break | ||
if flag: | ||
break | ||
time.sleep(0.5) | ||
end_time = time.time() | ||
if not flag: | ||
logger.info(f"rolling update process not found, wait for {end_time - start_time} seconds") | ||
else: | ||
logger.info(f"rolling update process {process} found, wait for {end_time - start_time} seconds") | ||
if flag: | ||
logger.info(f"wait {wait_time}s to kill rolling update process") | ||
time.sleep(wait_time) | ||
logger.info("start to kill rolling update process") | ||
try: | ||
p = psutil.Process(process["pid"]) | ||
p.terminate() | ||
logger.info(f"rolling update process: {process} killed") | ||
except Exception as e: | ||
logger.error(f"rolling update process: {process} kill failed, {e}") | ||
else: | ||
logger.info("all process info") | ||
for process in process_list: | ||
logger.info(process) | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import psutil | ||
import time | ||
from loguru import logger | ||
|
||
|
||
if __name__ == '__main__': | ||
import argparse | ||
parser = argparse.ArgumentParser(description='config for rolling update process') | ||
parser.add_argument('--wait_time', type=int, default=60, help='wait time after rolling update started') | ||
args = parser.parse_args() | ||
wait_time = args.wait_time | ||
logger.info("start to watch rolling update process") | ||
start_time = time.time() | ||
end_time = time.time() | ||
flag = True | ||
while flag and end_time - start_time < 360: | ||
process_list = [p.info for p in psutil.process_iter(attrs=['pid', 'name','cmdline'])] | ||
for process in process_list: | ||
if isinstance(process.get("cmdline", []), list): | ||
if "rollingUpdate.sh" in process.get("cmdline", []): | ||
logger.info(f"rolling update process: {process} started") | ||
flag = False | ||
break | ||
time.sleep(0.5) | ||
end_time = time.time() | ||
if flag: | ||
logger.info(f"rolling update process not found, wait for {end_time - start_time} seconds") | ||
logger.info(f"wait {wait_time}s to kill rolling update process") | ||
time.sleep(wait_time) | ||
logger.info("start to kill rolling update process") | ||
try: | ||
p = psutil.Process(process["pid"]) | ||
p.terminate() | ||
logger.info(f"rolling update process: {process} killed") | ||
except Exception as e: | ||
logger.error(f"rolling update process: {process} kill failed, {e}") | ||
|