def _status_predictor_too_old()

in source/forecast-shared/shared/Predictor/predictor.py [0:0]


    def _status_predictor_too_old(self, past_status: Dict) -> bool:
        last_modified = past_status.get("LastModificationTime")

        # check if (at least one of) the dataset files in this update are newer than the last predictor modification time
        datasets = self._dataset_group.datasets
        datasets_updated = False
        for dataset in datasets:
            dataset_last_modified = dataset.get("LastModificationTime")
            if dataset_last_modified > last_modified:
                datasets_updated = True
                logger.debug("status check: dataset %s newer than predictor")

        if not datasets_updated:
            logger.warning(
                "status check: no relevant dataset updates detected - did you mean to add new data?"
            )
            return False

        # check if the new dataset updates should trigger a predictor update
        now = datetime.now(timezone.utc)
        max_age_s = self._max_age_s
        max_age_d = now - timedelta(seconds=max_age_s)

        # we only have to check the max age if the data has actually changed within the window
        if last_modified < max_age_d:
            logger.info(
                "status check: predictor has surpassed max allowed age of %s seconds",
                max_age_s,
            )
            return True
        else:
            return False