class_docstr: Translate Airflow metadata to OpenLineage events instead of creating them from Airflow code.
class_docstr_tok: ["Translate","Airflow","metadata","to","OpenLineage","events","instead","of","creating","them","from","Airflow","code","."]
code: def _build_run(
      run_id: str,
      job_name: str,
      parent_job_name: str | None = None,
      parent_run_id: str | None = None,
      nominal_start_time: str | None = None,
      nominal_end_time: str | None = None,
      run_facets: dict[str, BaseFacet] | None = None,
  ) -> Run:
      facets: dict[str, BaseFacet] = {}
      if nominal_start_time:
          facets.update(
              {
                  "nominalTime": NominalTimeRunFacet(
                      nominal_start_time, nominal_end_time
                  )
              }
          )
      if parent_run_id:
          parent_run_facet = ParentRunFacet.create(
              runId=parent_run_id,
              namespace=_DAG_NAMESPACE,
              name=parent_job_name or job_name,
          )
          facets.update(
              {
                  "parent": parent_run_facet,
                  "parentRun": parent_run_facet,  # Keep sending this for the backward compatibility
              }
          )
  
      if run_facets:
          facets.update(run_facets)
  
      return Run(run_id, facets)
  
imports: from __future__ import annotations
  import os
  import uuid
  from typing import TYPE_CHECKING
  import yaml
  from openlineage.client import OpenLineageClient, set_producer
  from openlineage.client.facet import BaseFacet, DocumentationJobFacet, ErrorMessageRunFacet, NominalTimeRunFacet, OwnershipJobFacet, OwnershipJobFacetOwners, ParentRunFacet, ProcessingEngineRunFacet, SourceCodeLocationJobFacet
  from openlineage.client.run import Job, Run, RunEvent, RunState
  from airflow.configuration import conf
  from airflow.providers.openlineage import __version__
  from airflow.providers.openlineage.utils.utils import OpenLineageRedactor
  from airflow.stats import Stats
  from airflow.utils.log.logging_mixin import LoggingMixin
label_desc: Use image node_id 14 for calling the OpenLineageAdapter obj's underlying member method code with example usage: obj._build_run(run_id, job_name, parent_job_name, parent_run_id, nominal_start_time, nominal_end_time, run_facets) and returns: Run