docstr: 1. create db connection
  2. create test dataset
  3. start to train model in 'async' mode: check status
  4. start to train model in 'sync' mode: check status
  5. await model 2 is finished
  6. 2 messages in redis stream
docstr_tok: ["1.","create","db","connection","2.","create","test","dataset","3.","start","to","train","model","in","'async","'","mode",":","check","status","4.","start","to","train","model","in","'sync","'","mode",":","check","status","5.","await","model","2","is","finished","6",".","2","messages","in","redis","stream"]
code: def test_create_model(self):
      """1. create db connection
      2. create test dataset
      3. start to train model in 'async' mode: check status
      4. start to train model in 'sync' mode: check status
      5. await model 2 is finished
      6. 2 messages in redis stream
      """
  
      query = f"""
              CREATE DATABASE pg
              WITH ENGINE = 'postgres',
              PARAMETERS = {json.dumps(self.postgres_db['connection_data'])};
          """
      self.sql_via_http(query, RESPONSE_TYPE.OK)
  
      query = """
              SELECT * FROM pg (
                  CREATE TABLE test_data AS
                  SELECT
                      generate_series as id,
                      random()*100 as var_a,
                      random()*100 as var_b
                  FROM generate_series(1,50)
              )
          """
      self.sql_via_http(query, RESPONSE_TYPE.TABLE)
  
      query = """
              CREATE MODEL
              mindsdb.test_model_async
              FROM pg
              (SELECT * FROM test_data)
              PREDICT var_a;
          """
      response = self.sql_via_http(query, RESPONSE_TYPE.TABLE)
      status = response["data"][0][
          response["column_names"].index("STATUS")
      ]
      assert status in ("generating", "training")
  
      query = """
              CREATE MODEL
              mindsdb.test_model_sync
              FROM pg
              (SELECT * FROM test_data)
              PREDICT var_a
              USING join_learn_process=true;
          """
      response = self.sql_via_http(query, RESPONSE_TYPE.TABLE)
      status = response["data"][0][
          response["column_names"].index("STATUS")
      ]
      assert status == "complete"
  
      status = self.await_model("test_model_async")
      assert status == "complete"
  
      db = Database(protocol=3)
      assert TASKS_STREAM_NAME in db.keys()
      assert db.type(TASKS_STREAM_NAME) == b"stream"
      assert db.xlen(TASKS_STREAM_NAME) == 0
  
file_path: mindsdb/tests/integration_tests/flows/test_ml_task_queue.py
imports: import json
  import pytest
  from walrus import Database
  from mindsdb.api.executor.data_types.response_type import RESPONSE_TYPE
  from mindsdb.utilities.ml_task_queue.const import TASKS_STREAM_NAME
  from .http_test_helpers import HTTPHelperMixin
label_desc: Use image node_id 2 for calling the TestMLTaskQueue obj's underlying member method code with example usage: obj.test_create_model() without return types