docstr: dump and load dataset state on disk
docstr_tok: ["dump","and","load","dataset","state","on","disk"]
code: def dump_and_load_dataset(self):
      """dump and load dataset state on disk"""
      self._init_qlib()
      self._prepare_calender_cache()
      dataset = init_instance_by_config(self.task["dataset"])
      dataset_backtest = init_instance_by_config(
          self.task["dataset_backtest"]
      )
  
      ##=============dump dataset=============
      dataset.to_pickle(path="dataset.pkl")
      dataset_backtest.to_pickle(path="dataset_backtest.pkl")
  
      del dataset, dataset_backtest
      ##=============reload dataset=============
      with open("dataset.pkl", "rb") as file_dataset:
          dataset = pickle.load(file_dataset)
  
      with open("dataset_backtest.pkl", "rb") as file_dataset_backtest:
          dataset_backtest = pickle.load(file_dataset_backtest)
  
      self._prepare_calender_cache()
      ##=============reinit dataset=============
      dataset.config(
          handler_kwargs={
              "start_time": "2021-01-19 00:00:00",
              "end_time": "2021-01-25 16:00:00",
          },
          segments={
              "test": (
                  "2021-01-19 00:00:00",
                  "2021-01-25 16:00:00",
              ),
          },
      )
      dataset.setup_data(
          handler_kwargs={
              "init_type": DataHandlerLP.IT_LS,
          },
      )
      dataset_backtest.config(
          handler_kwargs={
              "start_time": "2021-01-19 00:00:00",
              "end_time": "2021-01-25 16:00:00",
          },
          segments={
              "test": (
                  "2021-01-19 00:00:00",
                  "2021-01-25 16:00:00",
              ),
          },
      )
      dataset_backtest.setup_data(handler_kwargs={})
  
      ##=============get data=============
      xtest = dataset.prepare("test")
      backtest_test = dataset_backtest.prepare("test")
  
      print(xtest, backtest_test)
      return
  
file_path: qlib/examples/highfreq/workflow.py
imports: import fire
  import qlib
  import pickle
  from qlib.constant import REG_CN
  from qlib.config import HIGH_FREQ_CONFIG
  from qlib.utils import init_instance_by_config
  from qlib.data.dataset.handler import DataHandlerLP
  from qlib.data.ops import Operators
  from qlib.data.data import Cal
  from qlib.tests.data import GetData
  from highfreq_ops import get_calendar_day, DayLast, FFillNan, BFillNan, Date, Select, IsNull, Cut
label_desc: Use image node_id 4 for calling the HighfreqWorkflow obj's underlying member method code with example usage: obj.dump_and_load_dataset() without return types