()
| 1153 | |
| 1154 | |
| 1155 | def main(): |
| 1156 | parser = ArgumentParser( |
| 1157 | epilog=dedent(""" |
| 1158 | Before running this script a CM cluster must be setup and any needed data |
| 1159 | such as TPC-H/DS must be loaded. The first time this script is run it will |
| 1160 | find memory limits and runtimes for each query and save the data to disk (since |
| 1161 | collecting the data is slow) at --runtime-info-path then run the stress test. |
| 1162 | Later runs will reuse the saved memory limits and timings. If the cluster changes |
| 1163 | significantly the memory limits should be re-measured (deleting the file at |
| 1164 | --runtime-info-path will cause re-measuring to happen).""").strip(), |
| 1165 | formatter_class=ArgumentDefaultsHelpFormatter) |
| 1166 | cli_options.add_logging_options(parser) |
| 1167 | cli_options.add_cluster_options(parser) |
| 1168 | cli_options.add_kerberos_options(parser) |
| 1169 | cli_options.add_ssl_options(parser) |
| 1170 | parser.add_argument( |
| 1171 | "--runtime-info-path", |
| 1172 | default=os.path.join(gettempdir(), "{cm_host}_query_runtime_info.json"), |
| 1173 | help="The path to store query runtime info at. '{cm_host}' will be replaced with" |
| 1174 | " the actual host name from --cm-host.") |
| 1175 | parser.add_argument( |
| 1176 | "--samples", default=1, type=int, |
| 1177 | help='Used when collecting "runtime info" - the number of samples to collect when' |
| 1178 | ' testing a particular mem limit value.') |
| 1179 | parser.add_argument( |
| 1180 | "--max-conflicting-samples", default=0, type=int, |
| 1181 | help='Used when collecting "runtime info" - the number of samples outcomes that' |
| 1182 | ' can disagree when deciding to accept a particular mem limit. Ex, when trying to' |
| 1183 | ' determine the mem limit that avoids spilling with samples=5 and' |
| 1184 | ' max-conflicting-samples=1, then 4/5 queries must not spill at a particular mem' |
| 1185 | ' limit.') |
| 1186 | parser.add_argument( |
| 1187 | "--mem-limit-eq-threshold-percent", default=0.025, |
| 1188 | type=float, help='Used when collecting "runtime info". If the difference between' |
| 1189 | ' two memory limits is less than this percentage, we consider the two limits to' |
| 1190 | ' be equal and stop the memory binary search.') |
| 1191 | parser.add_argument( |
| 1192 | "--mem-limit-eq-threshold-mb", default=50, |
| 1193 | type=int, help='Used when collecting "runtime info". If the difference between' |
| 1194 | ' two memory limits is less than this value in MB, we consider the two limits to' |
| 1195 | ' be equal and stop the memory binary search.') |
| 1196 | parser.add_argument( |
| 1197 | "--results-dir", default=gettempdir(), |
| 1198 | help="Directory under which the profiles and result_hashes directories are created." |
| 1199 | " Query hash results are written in the result_hashes directory. If query results" |
| 1200 | " do not match, a log file will be left in that dir. The log file is also created" |
| 1201 | " during the first run when runtime info is collected for each query. Unexpected" |
| 1202 | " query timeouts, exceeded memory, failures or result mismatches will result in a" |
| 1203 | " profile written in the profiles directory.") |
| 1204 | parser.add_argument( |
| 1205 | "--no-status", action="store_true", help="Do not print the status table.") |
| 1206 | parser.add_argument( |
| 1207 | "--cancel-current-queries", action="store_true", |
| 1208 | help="Cancel any queries running on the cluster before beginning.") |
| 1209 | parser.add_argument( |
| 1210 | "--filter-query-mem-ratio", type=float, default=0.333, |
| 1211 | help="Queries that require this ratio of total available memory will be filtered.") |
| 1212 | parser.add_argument( |
no test coverage detected