()
| 304 | |
| 305 | |
| 306 | def main(): |
| 307 | args = parser.parse_args() |
| 308 | |
| 309 | if getattr(args, "version", None): |
| 310 | return print_versions(args) |
| 311 | |
| 312 | if args.trace_threads: |
| 313 | try: |
| 314 | import hanging_threads |
| 315 | global trace_threads |
| 316 | trace_threads = True |
| 317 | except ModuleNotFoundError: |
| 318 | print(_( |
| 319 | "Required dependencies are not found. Please install them with " |
| 320 | "the following command:" |
| 321 | )) |
| 322 | print() |
| 323 | print(f" ${sys.executable} -m pip install 'ehforwarderbot[trace]'") |
| 324 | print() |
| 325 | exit(1) |
| 326 | |
| 327 | if args.profile: |
| 328 | coordinator.profile = str(args.profile) |
| 329 | |
| 330 | conf = config.load_config() |
| 331 | |
| 332 | setup_logging(args, conf) |
| 333 | setup_telemetry(conf['telemetry']) |
| 334 | |
| 335 | init(conf) |
| 336 | |
| 337 | # Only register graceful stop signals when we are ready to start |
| 338 | # polling threads. |
| 339 | atexit.register(stop_gracefully) |
| 340 | signal.signal(signal.SIGTERM, stop_gracefully) |
| 341 | signal.signal(signal.SIGINT, stop_gracefully) |
| 342 | |
| 343 | poll() |
| 344 | |
| 345 | |
| 346 | if __name__ == '__main__': |
no test coverage detected