class_docstr: Abstraction for ML task. Should have interface similat to concurrent.futures.Future
  
  Attributes:
      db (Redis): database object
      redis_key (RedisKey): redis keys associated with task
      dataframe (DataFrame): task result
      exception (Exception): task exeuton  runtime exception
      _timeout (int): max time without status updating
docstr: return tasks status untill it is not done or failed
          
docstr_tok: ["return","tasks","status","untill","it","is","not","done","or","failed"]
code: def subscribe(self) -> ML_TASK_STATUS:
      """return tasks status untill it is not done or failed"""
      pubsub = self.db.pubsub()
      cache = self.db.cache()
      pubsub.subscribe(self.redis_key.status)
      while msg := pubsub.get_message(timeout=self._timeout):
          if msg["type"] not in pubsub.PUBLISH_MESSAGE_TYPES:
              continue
          ml_task_status = ML_TASK_STATUS(msg["data"])
          if ml_task_status == ML_TASK_STATUS.COMPLETE:
              dataframe_bytes = cache.get(self.redis_key.dataframe)
              if dataframe_bytes is not None:
                  self.dataframe = from_bytes(dataframe_bytes)
              cache.delete(self.redis_key.dataframe)
          elif ml_task_status == ML_TASK_STATUS.ERROR:
              exception_bytes = cache.get(self.redis_key.exception)
              if exception_bytes is not None:
                  self.exception = from_bytes(exception_bytes)
          yield ml_task_status
      else:
          # there is no mesasges, timeout
          ml_task_status = ML_TASK_STATUS.TIMEOUT
          yield ml_task_status
  
file_path: mindsdb/mindsdb/utilities/ml_task_queue/task.py
imports: from collections.abc import Callable
  import redis
  from pandas import DataFrame
  from mindsdb.utilities.ml_task_queue.utils import RedisKey, from_bytes
  from mindsdb.utilities.ml_task_queue.const import ML_TASK_STATUS
label_desc: Use image node_id 2 for calling the Task obj's underlying member method code with example usage: obj.subscribe() without return types