MCPcopy Create free account
hub / github.com/assemblerflow/flowcraft / broadcast_report

Method broadcast_report

flowcraft/generator/report.py:473–528  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

471 logger.info("{}".format(report_address))
472
473 def broadcast_report(self):
474
475 logger.info(colored_print("Preparing to broacast reports...",
476 "green_bold"))
477
478 report_hash = self._get_report_id()
479
480 # When in watch mode,
481 if self.watch:
482 logger.info(colored_print("\tFetching pipeline run status",
483 "green_bold"))
484 self._update_pipeline_status()
485 logger.info(colored_print(
486 "\tSending initial request to test service", "green_bold"))
487 self._init_live_reports(report_hash)
488 logger.info(colored_print("\tInitial parsing of trace file",
489 "green_bold"))
490 self.update_trace_watch()
491
492 self._print_msg(report_hash)
493
494 logger.debug("Establishing connection...")
495
496 stay_alive = True
497 _broadcast_sent = False
498 try:
499 while stay_alive:
500
501 # When not in watch mode, send the report JSON once
502 if not _broadcast_sent and not self.watch:
503 self._send_report(report_hash)
504 self._print_msg(report_hash)
505 _broadcast_sent = True
506
507 # When in watch mode, continuously monitor the trace file for
508 # updates
509 if self.watch:
510 self.update_trace_watch()
511 self.update_log_watch()
512 # When new report JSON files are available, send then
513 # via a PUT request
514 if self.send:
515 self._send_live_report(report_hash)
516 self.send = False
517
518 sleep(self.refresh_rate)
519
520 except FileNotFoundError as e:
521 print(e)
522 logger.error(colored_print(
523 "ERROR: Report JSON file is not reachable!", "red_bold"))
524 except Exception as e:
525 logger.exception("ERROR: " + e)
526 finally:
527 logger.info("Closing connection")
528 self._close_connection(report_hash)

Callers 1

reportFunction · 0.95

Calls 10

_get_report_idMethod · 0.95
_init_live_reportsMethod · 0.95
update_trace_watchMethod · 0.95
_print_msgMethod · 0.95
_send_reportMethod · 0.95
update_log_watchMethod · 0.95
_send_live_reportMethod · 0.95
_close_connectionMethod · 0.95
colored_printFunction · 0.90

Tested by

no test coverage detected