class_docstr: OnlineManager can manage online models with `Online Strategy <#Online Strategy>`_.
  It also provides a history recording of which models are online at what time.
docstr: Prepare all models and signals if something is waiting for preparation.
  
  Args:
      model_kwargs: the params for `end_train`
      signal_kwargs: the params for `prepare_signals`
docstr_tok: ["Prepare","all","models","and","signals","if","something","is","waiting","for","preparation",".","Args",":","model_kwargs",":","the","params","for","`","end_train","`","signal_kwargs",":","the","params","for","`","prepare_signals","`"]
code: def delay_prepare(self, model_kwargs={}, signal_kwargs={}):
      """
      Prepare all models and signals if something is waiting for preparation.
  
      Args:
          model_kwargs: the params for `end_train`
          signal_kwargs: the params for `prepare_signals`
      """
      # FIXME:
      # This method is not implemented in the proper way!!!
      last_models = {}
      signals_time = D.calendar()[0]
      need_prepare = False
      for cur_time, strategy_models in self.history.items():
          self.cur_time = cur_time
  
          for strategy, models in strategy_models.items():
              # only new online models need to prepare
              if last_models.setdefault(strategy, set()) != set(models):
                  models = self.trainer.end_train(
                      models,
                      experiment_name=strategy.name_id,
                      **model_kwargs,
                  )
                  strategy.tool.reset_online_tag(models)
                  need_prepare = True
              last_models[strategy] = set(models)
  
          if need_prepare:
              # NOTE: Assumption: the predictions of online models need less than next cur_time, or this method will work in a wrong way.
              self.prepare_signals(**signal_kwargs)
              if signals_time > cur_time:
                  # FIXME: if use DelayTrainer and worker (and worker is faster than main progress), there are some possibilities of showing this warning.
                  self.logger.warn(
                      f"The signals have already parpred to {signals_time} by last preparation, but current time is only {cur_time}. This may be because the online models predict more than they should, which can cause signals to be contaminated by the offline models."
                  )
              need_prepare = False
              signals_time = self.signals.index.get_level_values(
                  "datetime"
              ).max()
  
imports: import logging
  from typing import Callable, List, Union
  import pandas
  from qlib import get_module_logger
  from qlib.data.data import D
  from qlib.log import set_global_logger_level
  from qlib.model.ens.ensemble import AverageEnsemble
  from qlib.model.trainer import Trainer, TrainerR
  from qlib.utils.serial import Serializable
  from qlib.workflow.online.strategy import OnlineStrategy
  from qlib.workflow.task.collect import MergeCollector
label_desc: Use image node_id 10 for calling the OnlineManager obj's underlying member method code with example usage: obj.delay_prepare(model_kwargs, signal_kwargs) without return types