Function used to set up individual threads. Each thread loops over the subdir_q, pulls a directory from there, and process the replay files in that directory. The threads finish when the subdir queue is empty, meaning each subdir has been processed. Args: in_dir (string) P
(in_dir, subdir_q, out_dir, num_sessions_per_file, single_line, fabricate_proxy_requests, cnt_q)
| 281 | |
| 282 | |
| 283 | def post_process(in_dir, subdir_q, out_dir, num_sessions_per_file, single_line, fabricate_proxy_requests, cnt_q): |
| 284 | """ Function used to set up individual threads. |
| 285 | |
| 286 | Each thread loops over the subdir_q, pulls a directory from there, and |
| 287 | process the replay files in that directory. The threads finish when the |
| 288 | subdir queue is empty, meaning each subdir has been processed. |
| 289 | |
| 290 | Args: |
| 291 | in_dir (string) Path to parent of the subdirectories in subdir_q. |
| 292 | subdir_q (Queue) Queue of subdir to read from. |
| 293 | out_dir (string) The directory into which the post processed replay files |
| 294 | are placed. |
| 295 | num_sessions_per_file (int) traffic_dump will emit a separate file per |
| 296 | session. This mechanism merges sessions within a single subdir. |
| 297 | num_sessions_per_file is the limit to the number of sessions merged |
| 298 | into a single replay file. |
| 299 | single_line (bool) Whether to emit replay files as a single line. If |
| 300 | false, the file is spaced out in a human readable fashion. |
| 301 | fabricate_proxy_requests (bool) Whether the post-processor should |
| 302 | fabricate proxy requests if they don't exist because the proxy served |
| 303 | the response locally. |
| 304 | cnt_q (Queue) Session, transaction, error count queue populated by each |
| 305 | thread. |
| 306 | """ |
| 307 | while not subdir_q.empty(): |
| 308 | subdir = subdir_q.get() |
| 309 | subdir_path = os.path.join(in_dir, subdir) |
| 310 | indent = 2 |
| 311 | if single_line: |
| 312 | indent = None |
| 313 | cnt = readAndCombine(subdir_path, num_sessions_per_file, indent, fabricate_proxy_requests, out_dir) |
| 314 | cnt_q.put(cnt) |
| 315 | |
| 316 | |
| 317 | def configure_logging(use_debug=False): |
nothing calls this directly
no test coverage detected