code: def exec_concurrent(
      context: PdfContext, executor: Executor
  ) -> Sequence[str]:
      """Execute the OCR pipeline concurrently."""
      options = context.options
      max_workers = min(len(context.pdfinfo), options.jobs)
      if max_workers > 1:
          log.info(
              "Start processing %d pages concurrently", max_workers
          )
  
      sidecars: list[Path | None] = [None] * len(context.pdfinfo)
      ocrgraft = OcrGrafter(context)
  
      def update_page(result: PageResult, pbar: ProgressBar):
          """After OCR is complete for a page, update the PDF."""
          try:
              set_thread_pageno(result.pageno + 1)
              sidecars[result.pageno] = result.text
              pbar.update()
              ocrgraft.graft_page(
                  pageno=result.pageno,
                  image=result.pdf_page_from_image,
                  textpdf=result.ocr,
                  autorotate_correction=result.orientation_correction,
              )
              pbar.update()
          finally:
              set_thread_pageno(None)
  
      executor(
          use_threads=options.use_threads,
          max_workers=max_workers,
          progress_kwargs=dict(
              total=(2 * len(context.pdfinfo)),
              desc="OCR"
              if options.tesseract_timeout > 0
              else "Image processing",
              unit="page",
              unit_scale=0.5,
              disable=not options.progress_bar,
          ),
          worker_initializer=partial(
              worker_init, PIL.Image.MAX_IMAGE_PIXELS
          ),
          task=_exec_page_sync,
          task_arguments=context.get_page_context_args(),
          task_finished=update_page,
      )
  
      # Output sidecar text
      if options.sidecar:
          text = merge_sidecars(sidecars, context)
          # Copy text file to destination
          copy_final(text, options.sidecar, options.input_file)
  
      # Merge layers to one single pdf
      pdf = ocrgraft.finalize()
  
      messages: Sequence[str] = []
      if options.output_type != "none":
          # PDF/A and metadata
          log.info("Postprocessing...")
          pdf, messages = postprocess(pdf, context, executor)
  
          # Copy PDF file to destination
          copy_final(pdf, options.output_file, options.input_file)
      return messages
  
imports: from __future__ import annotations
  import argparse
  import logging
  import logging.handlers
  from collections.abc import Sequence
  from functools import partial
  from pathlib import Path
  from tempfile import mkdtemp
  import PIL
  from ocrmypdf._concurrent import Executor
  from ocrmypdf._graft import OcrGrafter
  from ocrmypdf._jobcontext import PageContext, PdfContext
  from ocrmypdf._pipeline import copy_final, get_pdfinfo, is_ocr_required, merge_sidecars, ocr_engine_hocr, ocr_engine_textonly_pdf, render_hocr_page, triage, validate_pdfinfo_options
  from ocrmypdf._pipelines._common import PageResult, cli_exception_handler, manage_debug_log_handler, manage_work_folder, postprocess, process_page, report_output_pdf, set_thread_pageno, setup_pipeline, worker_init
  from ocrmypdf._plugin_manager import OcrmypdfPluginManager
  from ocrmypdf._progressbar import ProgressBar
  from ocrmypdf._validation import check_requested_output_file, create_input_file
  from ocrmypdf.exceptions import ExitCode
label_desc: Use image node_id 3 for calling a global function with example usage: exec_concurrent(context, executor) and returns: messages