Skip to content

Commit f09fe1e

Browse files
committed
feat: enhance CLI with short options and usage examples in various scripts
1 parent b55b14c commit f09fe1e

4 files changed

Lines changed: 44 additions & 7 deletions

File tree

manager_scripts/generate_exec_scripts.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,17 @@
3232

3333
if __name__ == "__main__":
3434
parser = argparse.ArgumentParser(
35-
description="Generate Docker execution scripts and compose files from a JSON topology"
35+
description="Generate Docker execution scripts and compose files from a JSON topology",
36+
formatter_class=argparse.RawDescriptionHelpFormatter,
37+
usage=(
38+
"%(prog)s <topology.json> [--ws-dir|-w <dir>] [--force|-f] "
39+
"[--rmw|-m <rmw>] [--help|-h]"
40+
),
41+
epilog="""
42+
Examples:
43+
python3 manager_scripts/generate_exec_scripts.py topology_example/simple.json --rmw fastdds --ws-dir performance_ws
44+
short: python3 manager_scripts/generate_exec_scripts.py topology_example/simple.json -m fastdds -w performance_ws
45+
""",
3646
)
3747
parser.add_argument("json_path", help="Path to the input JSON file")
3848
parser.add_argument(

performance_test/all_latency.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,15 @@ def process_log_directory(log_dir_name, logs_base_path, results_base_path):
352352

353353
if __name__ == "__main__":
354354
parser = argparse.ArgumentParser(
355-
description="Process log directories and save latency results.")
355+
description="Process log directories and save latency results.",
356+
formatter_class=argparse.RawDescriptionHelpFormatter,
357+
usage="%(prog)s [--logs|-l DIR] [--results|-r DIR] [--help|-h]",
358+
epilog="""
359+
Examples:
360+
python3 performance_test/all_latency.py --logs ./logs --results ./results
361+
short: python3 performance_test/all_latency.py -l ./logs -r ./results
362+
""",
363+
)
356364
parser.add_argument("-l", "--logs", type=str, default="./logs",
357365
help="Base path for logs")
358366
parser.add_argument("-r", "--results", type=str,

performance_test/performance_test.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,19 @@
1111

1212
if __name__ == "__main__":
1313
parser = argparse.ArgumentParser(
14-
description="Run performance tests using run.sh defaults")
14+
description="Run performance tests using run.sh defaults",
15+
formatter_class=argparse.RawDescriptionHelpFormatter,
16+
usage=(
17+
"%(prog)s [--trials|-t N] [--eval-time|-e SEC] "
18+
"[--exec-policy|-p {docker,native,local}] [--ws-dir|-w DIR] "
19+
"[--scenario|-s NAME] [--help|-h]"
20+
),
21+
epilog="""
22+
Examples:
23+
python3 performance_test/performance_test.py --exec-policy local --trials 5 --eval-time 60
24+
short: python3 performance_test/performance_test.py -p local -t 5 -e 60
25+
""",
26+
)
1527
parser.add_argument("-t", "--trials", type=int, default=3,
1628
help="Number of trials (default: 3)")
1729
parser.add_argument("-e", "--eval-time", type=int, default=None,

remote_hosts_scripts/start_exec_scripts.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
Supports both Docker and native execution modes.
44
55
Usage:
6+
python3 start_exec_scripts.py [--exec-policy|-p {docker,native}] [--trial-idx|-t N] [--prepare-run|-r] [--ws-dir|-w DIR] [--scenario|-s NAME] [--hosts-list|-l HOSTS] [--help|-h]
7+
68
# Docker mode (sends /start_docker requests)
79
python3 start_exec_scripts.py --exec-policy docker --trial-idx 1 --ws-dir performance_ws --scenario latest --hosts-list host1,host2,host3
810
short: python3 start_exec_scripts.py -p docker -t 1 -w performance_ws -s latest -l host1,host2,host3
@@ -64,15 +66,20 @@ def main():
6466
parser = argparse.ArgumentParser(
6567
description="Start test execution on all hosts (Docker or native)",
6668
formatter_class=argparse.RawDescriptionHelpFormatter,
69+
usage=(
70+
"%(prog)s [--exec-policy|-p {docker,native}] [--trial-idx|-t N] "
71+
"[--prepare-run|-r] [--ws-dir|-w DIR] [--scenario|-s NAME] "
72+
"[--hosts-list|-l HOSTS] [--help|-h]"
73+
),
6774
epilog="""
6875
Examples:
6976
# Docker mode
70-
python3 start_exec_scripts.py --exec-policy docker --trial-idx 1 --ws-dir performance_ws --scenario latest --hosts-list host1,host2,host3
71-
short: python3 start_exec_scripts.py -p docker -t 1 -w performance_ws -s latest -l host1,host2,host3
77+
python3 start_exec_scripts.py --exec-policy docker --trial-idx 1 --ws-dir performance_ws --scenario latest --hosts-list host1,host2,host3
78+
short: python3 start_exec_scripts.py -p docker -t 1 -w performance_ws -s latest -l host1,host2,host3
7279
7380
# Native mode
74-
python3 start_exec_scripts.py --exec-policy native --trial-idx 1 --ws-dir performance_ws --scenario latest --hosts-list host1,host2,host3
75-
short: python3 start_exec_scripts.py -p native -t 1 -w performance_ws -s latest -l host1,host2,host3
81+
python3 start_exec_scripts.py --exec-policy native --trial-idx 1 --ws-dir performance_ws --scenario latest --hosts-list host1,host2,host3
82+
short: python3 start_exec_scripts.py -p native -t 1 -w performance_ws -s latest -l host1,host2,host3
7683
"""
7784
)
7885
parser.add_argument(

0 commit comments

Comments
 (0)