@@ -7,52 +7,96 @@ def add_common_options(parser):
77 parser .add_argument ("-t" , "--table-name" , default = "key_value" , help = "Table name" )
88
99
10- def make_create_parser (subparsers ):
11- create_parser = subparsers .add_parser ("create" , help = "Create tables and fill with initial content" )
12- add_common_options (create_parser )
10+ def make_table_create_parser (subparsers ):
11+ table_create_parser = subparsers .add_parser ("table- create" , help = "Create tables and fill with initial content" )
12+ add_common_options (table_create_parser )
1313
14- create_parser .add_argument (
14+ table_create_parser .add_argument (
1515 "-p-min" , "--min-partitions-count" , default = 6 , type = int , help = "Minimum amount of partitions in table"
1616 )
17- create_parser .add_argument (
17+ table_create_parser .add_argument (
1818 "-p-max" , "--max-partitions-count" , default = 1000 , type = int , help = "Maximum amount of partitions in table"
1919 )
20- create_parser .add_argument ("-p-size" , "--partition-size" , default = 100 , type = int , help = "Partition size [mb]" )
21- create_parser .add_argument (
20+ table_create_parser .add_argument ("-p-size" , "--partition-size" , default = 100 , type = int , help = "Partition size [mb]" )
21+ table_create_parser .add_argument (
2222 "-c" , "--initial-data-count" , default = 1000 , type = int , help = "Total number of records to generate"
2323 )
2424
25- create_parser .add_argument ("--write-timeout" , default = 20000 , type = int , help = "Write requests execution timeout [ms]" )
25+ table_create_parser .add_argument ("--write-timeout" , default = 20000 , type = int , help = "Write requests execution timeout [ms]" )
2626
27- create_parser .add_argument (
27+ table_create_parser .add_argument (
2828 "--batch-size" , default = 100 , type = int , help = "Number of new records in each create request"
2929 )
30- create_parser .add_argument ("--threads" , default = 10 , type = int , help = "Number of threads to use" )
30+ table_create_parser .add_argument ("--threads" , default = 10 , type = int , help = "Number of threads to use" )
3131
3232
33- def make_run_parser (subparsers , name = "run" ):
34- run_parser = subparsers .add_parser (name , help = "Run measurable workload" )
35- add_common_options (run_parser )
33+ def make_table_run_parser (subparsers ):
34+ table_run_parser = subparsers .add_parser ("table-run" , help = "Run table SLO workload" )
35+ add_common_options (table_run_parser )
3636
37- run_parser .add_argument ("--read-rps" , default = 100 , type = int , help = "Read request rps" )
38- run_parser .add_argument ("--read-timeout" , default = 10000 , type = int , help = "Read requests execution timeout [ms]" )
37+ table_run_parser .add_argument ("--read-rps" , default = 100 , type = int , help = "Read request rps" )
38+ table_run_parser .add_argument ("--read-timeout" , default = 10000 , type = int , help = "Read requests execution timeout [ms]" )
3939
40- run_parser .add_argument ("--write-rps" , default = 10 , type = int , help = "Write request rps" )
41- run_parser .add_argument ("--write-timeout" , default = 20000 , type = int , help = "Write requests execution timeout [ms]" )
40+ table_run_parser .add_argument ("--write-rps" , default = 10 , type = int , help = "Write request rps" )
41+ table_run_parser .add_argument ("--write-timeout" , default = 20000 , type = int , help = "Write requests execution timeout [ms]" )
4242
43- run_parser .add_argument ("--time" , default = 10 , type = int , help = "Time to run in seconds" )
44- run_parser .add_argument ("--shutdown-time" , default = 10 , type = int , help = "Graceful shutdown time in seconds" )
43+ table_run_parser .add_argument ("--time" , default = 10 , type = int , help = "Time to run in seconds" )
44+ table_run_parser .add_argument ("--shutdown-time" , default = 10 , type = int , help = "Graceful shutdown time in seconds" )
4545
46- run_parser .add_argument ("--prom-pgw" , default = "localhost:9091" , type = str , help = "Prometheus push gateway" )
47- run_parser .add_argument ("--report-period" , default = 1000 , type = int , help = "Prometheus push period in [ms]" )
46+ table_run_parser .add_argument ("--prom-pgw" , default = "localhost:9091" , type = str , help = "Prometheus push gateway" )
47+ table_run_parser .add_argument ("--report-period" , default = 1000 , type = int , help = "Prometheus push period in [ms]" )
4848
49- run_parser .add_argument ("--read-threads" , default = 8 , type = int , help = "Number of threads to use for write" )
50- run_parser .add_argument ("--write-threads" , default = 4 , type = int , help = "Number of threads to use for read" )
49+ table_run_parser .add_argument ("--read-threads" , default = 8 , type = int , help = "Number of threads to use for write" )
50+ table_run_parser .add_argument ("--write-threads" , default = 4 , type = int , help = "Number of threads to use for read" )
5151
5252
53- def make_cleanup_parser (subparsers ):
54- cleanup_parser = subparsers .add_parser ("cleanup" , help = "Drop tables" )
55- add_common_options (cleanup_parser )
53+ def make_topic_run_parser (subparsers ):
54+ """Создает парсер для команды topic-run - запуск SLO тестов для топиков"""
55+ topic_parser = subparsers .add_parser ("topic-run" , help = "Run topic SLO workload" )
56+ add_common_options (topic_parser )
57+
58+ topic_parser .add_argument ("--topic-read-rps" , default = 50 , type = int , help = "Topic read request rps" )
59+ topic_parser .add_argument ("--topic-read-timeout" , default = 5000 , type = int , help = "Topic read timeout [ms]" )
60+ topic_parser .add_argument ("--topic-write-rps" , default = 20 , type = int , help = "Topic write request rps" )
61+ topic_parser .add_argument ("--topic-write-timeout" , default = 10000 , type = int , help = "Topic write timeout [ms]" )
62+ topic_parser .add_argument ("--topic-read-threads" , default = 1 , type = int , help = "Number of threads for topic reading" )
63+ topic_parser .add_argument ("--topic-write-threads" , default = 1 , type = int , help = "Number of threads for topic writing" )
64+ topic_parser .add_argument ("--topic-path" , default = "/local/slo_topic" , type = str , help = "Topic path" )
65+ topic_parser .add_argument ("--topic-consumer" , default = "slo_consumer" , type = str , help = "Topic consumer name" )
66+ topic_parser .add_argument ("--topic-message-size" , default = 100 , type = int , help = "Topic message size in bytes" )
67+ topic_parser .add_argument ("--topic-min-partitions" , default = 1 , type = int , help = "Minimum active partitions" )
68+ topic_parser .add_argument ("--topic-max-partitions" , default = 10 , type = int , help = "Maximum active partitions" )
69+ topic_parser .add_argument ("--topic-retention-hours" , default = 24 , type = int , help = "Retention period in hours" )
70+
71+ topic_parser .add_argument ("--time" , default = 60 , type = int , help = "Time to run in seconds" )
72+ topic_parser .add_argument ("--shutdown-time" , default = 10 , type = int , help = "Graceful shutdown time in seconds" )
73+ topic_parser .add_argument ("--prom-pgw" , default = "" , type = str , help = "Prometheus push gateway (empty to disable)" )
74+ topic_parser .add_argument ("--report-period" , default = 1000 , type = int , help = "Prometheus push period in [ms]" )
75+
76+
77+ def make_topic_create_parser (subparsers ):
78+ """Создает парсер для команды topic-create"""
79+ topic_create_parser = subparsers .add_parser ("topic-create" , help = "Create topic with consumer" )
80+ add_common_options (topic_create_parser )
81+
82+ topic_create_parser .add_argument ("--topic-path" , default = "/local/slo_topic" , type = str , help = "Topic path" )
83+ topic_create_parser .add_argument ("--topic-consumer" , default = "slo_consumer" , type = str , help = "Topic consumer name" )
84+ topic_create_parser .add_argument ("--topic-min-partitions" , default = 1 , type = int , help = "Minimum active partitions" )
85+ topic_create_parser .add_argument ("--topic-max-partitions" , default = 10 , type = int , help = "Maximum active partitions" )
86+ topic_create_parser .add_argument ("--topic-retention-hours" , default = 24 , type = int , help = "Retention period in hours" )
87+
88+
89+ def make_table_cleanup_parser (subparsers ):
90+ table_cleanup_parser = subparsers .add_parser ("table-cleanup" , help = "Drop tables" )
91+ add_common_options (table_cleanup_parser )
92+
93+
94+ def make_topic_cleanup_parser (subparsers ):
95+ """Создает парсер для команды topic-cleanup"""
96+ topic_cleanup_parser = subparsers .add_parser ("topic-cleanup" , help = "Drop topic" )
97+ add_common_options (topic_cleanup_parser )
98+
99+ topic_cleanup_parser .add_argument ("--topic-path" , default = "/local/slo_topic" , type = str , help = "Topic path" )
56100
57101
58102def get_root_parser ():
@@ -67,9 +111,12 @@ def get_root_parser():
67111 help = "List of subcommands" ,
68112 )
69113
70- make_create_parser (subparsers )
71- make_run_parser (subparsers )
72- make_cleanup_parser (subparsers )
114+ make_table_create_parser (subparsers )
115+ make_table_run_parser (subparsers )
116+ make_table_cleanup_parser (subparsers )
117+ make_topic_create_parser (subparsers )
118+ make_topic_run_parser (subparsers )
119+ make_topic_cleanup_parser (subparsers )
73120
74121 return parser
75122
0 commit comments