snews_cs.heartbeat_feedbacks ============================ .. py:module:: snews_cs.heartbeat_feedbacks Attributes ---------- .. autoapisummary:: snews_cs.heartbeat_feedbacks.log snews_cs.heartbeat_feedbacks.contact_list_file snews_cs.heartbeat_feedbacks.contact_list snews_cs.heartbeat_feedbacks.detector_file snews_cs.heartbeat_feedbacks.snews_detectors snews_cs.heartbeat_feedbacks.snews_detectors snews_cs.heartbeat_feedbacks.cache_db snews_cs.heartbeat_feedbacks.cache_engine snews_cs.heartbeat_feedbacks.cache_df Classes ------- .. autoapisummary:: snews_cs.heartbeat_feedbacks.FeedBack Functions --------- .. autoapisummary:: snews_cs.heartbeat_feedbacks.vprint snews_cs.heartbeat_feedbacks.check_frequencies_and_send_mail snews_cs.heartbeat_feedbacks.plot_beats snews_cs.heartbeat_feedbacks.delete_old_figures Module Contents --------------- .. py:data:: log .. py:data:: contact_list_file :value: b'.' .. py:data:: contact_list .. py:data:: detector_file :value: b'.' .. py:data:: snews_detectors .. py:data:: snews_detectors .. py:function:: vprint(inp, _bool) .. py:data:: cache_db .. py:data:: cache_engine .. py:data:: cache_df :value: None .. py:class:: FeedBack(verbose=False) Once every minute, check the HB of each detector. If the last heartbeat is from longer than usual, send an email Once every user-defined time interval, send a plot with latency and frequency statistics .. py:attribute:: detectors .. py:attribute:: last_feedback_time .. py:attribute:: day_in_min :value: 1440 .. py:attribute:: running_min :value: 0 .. py:attribute:: db_found :value: False .. py:attribute:: verbose :value: False .. py:method:: __call__() Continuously run and check expected heartbeats every minute Also, check if the detectors requested feedbacks create and send feedbacks with the desired time intervals .. py:method:: dataframe_from_db_table() Try to read the database, if it is empty (or does not exist) wait .. py:method:: control(df) Check the current cache, check if any detector missed a beat .. py:method:: check_missed_beats(df, detector) Check if a heartbeat is skipped .. py:method:: check_enough_detectors() Constantly check to make sure there is at least two detector taking data. If not, send a warning to everyone. .. py:function:: check_frequencies_and_send_mail(detector, given_contact=None) Create a plot with latency and heartbeat frequencies and send it via emails .. py:function:: plot_beats(df, detector, figname) Requires QT libraries: sudo apt-get install qt5-default .. py:function:: delete_old_figures() Remove the old feedback figures from the server the duration set in the configuration file