code: def _run_opts_to_proto(
      run_options: pipeline_py.RunOptions,
  ) -> pipeline_pb2.RunOptions:
      """Converts a RunOptions dataclass to proto."""
      result = pipeline_pb2.RunOptions()
      snapshot_settings = result.partial_run.snapshot_settings
      if run_options.base_pipeline_run_id is not None:
          snapshot_settings.base_pipeline_run_strategy.base_run_id = (
              run_options.base_pipeline_run_id
          )
      else:
          snapshot_settings.latest_pipeline_run_strategy.SetInParent()
      result.partial_run.from_nodes.extend(run_options.from_nodes or [])
      result.partial_run.to_nodes.extend(run_options.to_nodes or [])
      return result
  
file_path: tfx/tfx/orchestration/portable/tfx_runner.py
imports: import abc
  from typing import Any, Optional
  from tfx.dsl.compiler import compiler
  from tfx.dsl.components.base import base_component
  from tfx.orchestration import pipeline
  from tfx.proto.orchestration import pipeline_pb2
  from tfx.utils import doc_controls
label_desc: Use image node_id 2 for calling a global function with example usage: _run_opts_to_proto(run_options) and returns: result