pipeline.src.shared_tasks.healthcheck ===================================== .. py:module:: pipeline.src.shared_tasks.healthcheck Functions --------- .. autoapisummary:: pipeline.src.shared_tasks.healthcheck.get_monitorfish_healthcheck pipeline.src.shared_tasks.healthcheck.assert_positions_received_by_api_health pipeline.src.shared_tasks.healthcheck.assert_last_positions_flow_health pipeline.src.shared_tasks.healthcheck.assert_logbook_health Module Contents --------------- .. py:function:: get_monitorfish_healthcheck() -> src.entities.monitorfish_healthcheck.MonitorfishHealthcheck Fetches healthcheck on Monitorfish healthcheck endpoint. :returns: MonitorfishHealthcheck .. py:function:: assert_positions_received_by_api_health(healthcheck: src.entities.monitorfish_healthcheck.MonitorfishHealthcheck, utcnow: datetime.datetime = None, max_minutes_without_data: int = 10) Checks if the `date_last_position_received_by_api` of the input `MonitorfishHealthcheck` is within `max_minutes_without_data` minutes of `utcnow`. :param healthcheck: `MonitorfishHealthcheck` to check. :type healthcheck: MonitorfishHealthcheck :param utcnow: Date with which to compare the latest position's reception date. If not supplied, the current server time is used. Defaults to None. :type utcnow: datetime, optional :param max_minutes_without_data: maximum number of minutes allow between `date_position_received` and `utcnow`. Defaults to 10. :type max_minutes_without_data: int, optional :raises MonitorfishHealthError: If the most recent data received is older than `max_minutes_without_data`. .. py:function:: assert_last_positions_flow_health(healthcheck: src.entities.monitorfish_healthcheck.MonitorfishHealthcheck, utcnow: datetime.datetime = None, max_minutes_without_data: int = 10) Checks if the date_time of most recent `date_last_position_updated_by_prefect` is in the last `max_minutes_without_data` minutes in the input `MonitorfishHealthcheck`. :param healthcheck: `MonitorfishHealthcheck` to check. :type healthcheck: MonitorfishHealthcheck :param utcnow: Date with which to compare the latest last_position's reception date. If not supplied, the current server time is used. Defaults to None. :type utcnow: datetime, optional :param max_minutes_without_data: Number of minutes above which an absence of data is considered an unhealthy. Defaults to 10. :type max_minutes_without_data: int, optional :raises MonitorfishHealthError: If the most recent data received is older than `max_minutes_without_data`. .. py:function:: assert_logbook_health(healthcheck: src.entities.monitorfish_healthcheck.MonitorfishHealthcheck, utcnow: datetime.datetime = None, max_minutes_without_data: int = 20) Checks if the `date_logbook_message_received` of in the input `MonitorfishHealthcheck` is older than `max_minutes_without_data` minutes. :param healthcheck: `MonitorfishHealthcheck` to check. :type healthcheck: MonitorfishHealthcheck :param utcnow: Date with which to compare the `date_logbook_message_received` of the input healthcheck. If not supplied, the current server time is used. Defaults to None. :type utcnow: datetime, optional :param max_minutes_without_data: Number of minutes above which an absence of data is considered an unhealthy. Defaults to 20. :type max_minutes_without_data: int, optional :raises MonitorfishHealthError: If the most recent data received is older than `max_minutes_without_data`.