code: def in_db_filtering_state_init(params: dict, args: Namespace):
      global search_space_ins, _evaluator, sampler
      from src.logger import logger
      from src.controller.sampler_all.seq_sampler import SequenceSampler
      from src.eva_engine.phase1.evaluator import P1Evaluator
      from src.search_space.init_search_space import init_search_space
  
      db_config = {
          "db_name": args.db_name,
          "db_user": args.db_user,
          "db_host": args.db_host,
          "db_port": args.db_port,
      }
  
      # init once
      # params["eva_results"] == "null" means it a new job
      if params["eva_results"] == "null" or (
          search_space_ins is None
          and _evaluator is None
          and sampler is None
      ):
          logger.info(
              f'New job = {params["eva_results"]}, search_space_ins = {search_space_ins}'
          )
          search_space_ins = init_search_space(args)
          _evaluator = P1Evaluator(
              device=args.device,
              num_label=args.num_labels,
              dataset_name=params["dataset"],
              search_space_ins=search_space_ins,
              train_loader=None,
              is_simulate=False,
              metrics=args.tfmem,
              enable_cache=args.embedding_cache_filtering,
              db_config=db_config,
              data_retrievel="spi",
          )
          sampler = SequenceSampler(search_space_ins)
  
      arch_id, arch_micro = sampler.sample_next_arch()
      model_encoding = search_space_ins.serialize_model_encoding(
          arch_micro
      )
  
      return orjson.dumps(
          {"model_encoding": model_encoding, "arch_id": arch_id}
      ).decode("utf-8")
  
imports: import calendar
  import os
  import time
  import requests
  import json
  from typing import List, Dict
  import traceback
  import orjson
  from argparse import Namespace
  from shared_config import parse_config_arguments
  from torch.utils.data import Dataset
  import torch
label_desc: Use image node_id 15 for calling a global function with example usage: in_db_filtering_state_init(params, args) and returns: orjson