class_docstr: The argilla dataset listener class
  
  Args:
      dataset: The dataset over which listener is created
      action: The action to execute when the condition is satisfied
      metrics: A list of metrics ids that will be required in condition
      query: The query string to apply
      query_params: Defined parameters used dynamically in the provided query
      condition: The condition to satisfy to execute the action
      query_records: If ``False``, the records won't be passed as argument to the action.
          Default: ``True``
      interval_in_seconds: How often the listener is executed. Default to 30 seconds
class_docstr_tok: ["The","argilla","dataset","listener","class","Args",":","dataset",":","The","dataset","over","which","listener","is","created","action",":","The","action","to","execute","when","the","condition","is","satisfied","metrics",":","A","list","of","metrics","ids","that","will","be","required","in","condition","query",":","The","query","string","to","apply","query_params",":","Defined","parameters","used","dynamically","in","the","provided","query","condition",":","The","condition","to","satisfy","to","execute","the","action","query_records",":","If","``","False","``",",","the","records","wo","n't","be","passed","as","argument","to","the","action",".","Default",":","``","True","``","interval_in_seconds",":","How","often","the","listener","is","executed",".","Default","to","30","seconds"]
docstr: Execute a complete listener iteration. The iteration consists on:
  
  1. Query data and fetch configured metrics
  2. Check search results and metrics with provided condition
  3. Execute the action if condition is satisfied
docstr_tok: ["Execute","a","complete","listener","iteration",".","The","iteration","consists","on",":","1",".","Query","data","and","fetch","configured","metrics","2",".","Check","search","results","and","metrics","with","provided","condition","3",".","Execute","the","action","if","condition","is","satisfied"]
code: def __listener_iteration_job__(self, *args, **kwargs):
      """
      Execute a complete listener iteration. The iteration consists on:
  
      1. Query data and fetch configured metrics
      2. Check search results and metrics with provided condition
      3. Execute the action if condition is satisfied
  
      """
      current_api = singleton.active_api()
      try:
          dataset = current_api.datasets.find_by_name(self.dataset)
          self._LOGGER.debug(f"Found listener dataset {dataset.name}")
      except NotFoundApiError:
          self._LOGGER.warning(f"Not found dataset <{self.dataset}>")
          return
  
      ctx = RGListenerContext(
          listener=self,
          query_params=self.query_params,
          metrics=self.__compute_metrics__(
              current_api, dataset, query=self.formatted_query
          ),
      )
      if self.condition is None:
          self._LOGGER.debug("No condition found! Running action...")
          return self.__run_action__(ctx, *args, **kwargs)
  
      search_results = current_api.search.search_records(
          name=self.dataset,
          task=dataset.task,
          size=0,
          query_text=self.formatted_query,
      )
  
      ctx.search = Search(
          total=search_results.total,
          query_params=copy.deepcopy(ctx.query_params),
      )
      condition_args = [ctx.search]
      if self.metrics:
          condition_args.append(ctx.metrics)
  
      self._LOGGER.debug(
          f"Evaluate condition with arguments: {condition_args}"
      )
      if self.condition(*condition_args):
          self._LOGGER.debug("Condition passed! Running action...")
          return self.__run_action__(ctx, *args, **kwargs)
  
imports: import copy
  import dataclasses
  import functools
  import logging
  import threading
  import time
  from typing import Any, Dict, List, Optional
  import schedule
  import argilla
  from argilla.client import singleton
  from argilla.client.sdk.commons.errors import NotFoundApiError
  from argilla.listeners.models import ListenerAction, ListenerCondition, Metrics, RGListenerContext, Search
label_desc: Use image node_id 8 for calling the RGDatasetListener obj's underlying member method code with example usage: obj.__listener_iteration_job__() and returns: self, self