in source/forecast-shared/shared/Predictor/predictor.py [0:0]
def status(self) -> Status:
"""
Get the status of the predictor as defined. The status might be DOES_NOT_EXIST if a predictor of the desired
format does not yet exist, or a predictor needs to be regenerated.
:return: Status
"""
# this ensures that only the last file uploaded will trigger predictor generation
if not self._status_most_recent_update():
raise NotMostRecentUpdate
# check if dataset group is ready (all datasets are imported)
# this raises exception DatasetsImporting if one or more datasets is importing
dataset_group_ready = self._dataset_group.ready()
if dataset_group_ready:
logger.info("status check: all datasets have been successfully imported")
past_status = self._status_last_predictor()
if not past_status:
return Status.DOES_NOT_EXIST
# if the predictor is too old (and there is new data to train on), we return Status.DOES_NOT_EXIST to retrain
too_old = self._status_predictor_too_old(past_status)
if too_old:
return Status.DOES_NOT_EXIST
logger.info("status check: predictor status is %s" % past_status.get("Status"))
self.set_user_tags(resource_arn=past_status["PredictorArn"])
return Status[past_status.get("Status")]