code: def _run_pipeline(
      options: argparse.Namespace,
      plugin_manager: OcrmypdfPluginManager,
  ) -> ExitCode:
      with manage_work_folder(
          work_folder=Path(mkdtemp(prefix="ocrmypdf.io.")),
          retain=options.keep_temporary_files,
          print_location=options.keep_temporary_files,
      ) as work_folder, manage_debug_log_handler(
          options=options, work_folder=work_folder
      ):
          executor = setup_pipeline(options, plugin_manager)
          check_requested_output_file(options)
          start_input_file, original_filename = create_input_file(
              options, work_folder
          )
  
          # Triage image or pdf
          origin_pdf = triage(
              original_filename,
              start_input_file,
              work_folder / "origin.pdf",
              options,
          )
  
          # Gather pdfinfo and create context
          pdfinfo = get_pdfinfo(
              origin_pdf,
              executor=executor,
              detailed_analysis=options.redo_ocr,
              progbar=options.progress_bar,
              max_workers=options.jobs,
              use_threads=options.use_threads,
              check_pages=options.pages,
          )
  
          context = PdfContext(
              options, work_folder, origin_pdf, pdfinfo, plugin_manager
          )
  
          # Validate options are okay for this pdf
          validate_pdfinfo_options(context)
  
          # Execute the pipeline
          optimize_messages = exec_concurrent(context, executor)
  
          exitcode = report_output_pdf(
              options, start_input_file, optimize_messages
          )
          return exitcode
  
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 4 for calling a global function with example usage: _run_pipeline(options, plugin_manager) and returns: exitcode