def predict_mode(user_id): time_query = epq.get_time_range_for_mode_inference(user_id) try: mip = ModeInferencePipeline() mip.user_id = user_id mip.runPredictionPipeline(user_id, time_query) if mip.getLastSectionDone() is None: logging.debug("after, run, last_section_done == None, must be early return") epq.mark_mode_inference_done(user_id, None) return else: epq.mark_mode_inference_done(user_id, mip.getLastSectionDone()) except: logging.exception("Error while inferring modes, timestamp is unchanged") epq.mark_mode_inference_failed(user_id)
def predict_mode(user_id): time_query = epq.get_time_range_for_mode_inference(user_id) try: mip = RuleEngineModeInferencePipeline() mip.user_id = user_id mip.runPredictionPipeline(user_id, time_query) if mip.getLastSectionDone() is None: logging.debug( "after, run, last_section_done == None, must be early return") epq.mark_mode_inference_done(user_id, None) return else: epq.mark_mode_inference_done(user_id, mip.getLastSectionDone()) except: logging.exception( "Error while inferring modes, timestamp is unchanged") epq.mark_mode_inference_failed(user_id)