code: def submit_db_queries(
      cursor: psycopg.Cursor, queries: List[Tuple[str, str]]
  ) -> Generator[Tuple[str, int], None, None]:
      """
      submit a set of db queries concurrently yield the changes as they are ready.
      queries: list of (name, query)
      """
      with concurrent.futures.ThreadPoolExecutor(
          max_workers=4
      ) as executor:
          # submit each query and record the rows affected for each one
          def job(name: str, query: str) -> Tuple[str, int]:
              cursor.execute(query)
              return name, cursor.rowcount
  
          futures = [
              executor.submit(job, name, query)
              for name, query in queries
          ]
          # process as each future ready
          for future in concurrent.futures.as_completed(futures):
              yield future.result()
  
file_path: determined/tools/scripts/replicate-metrics.py
imports: import concurrent.futures
  import contextlib
  import os
  import time
  from typing import Any, Dict, Generator, List, Set, Tuple, Union
  import psycopg
  from psycopg import sql
label_desc: Use image node_id 5 for calling a global function with example usage: submit_db_queries(cursor, queries) and returns: name,  cursor