class_docstr: Abstract base class for Patchers for various "DagRunner"s.
  
  These patcher classes "decorate" the `run` function of the DagRunners.
  The patcher can intercept arguments before/after the run() execution,
  and even skip the real run() execution.
  Users of the patcher can read information about the run using `context`
  which is passed as a context manager of patch(). For example,
  the name of the pipeline can be retrieved with
  `context[DagRunnerPatcher.PIPELINE_NAME]`.
  
  Child class should override get_runner_class() to specify which DagRunner
  class they patch. And they can add more actions in before_run()/after_run()
  as they needed.
class_docstr_tok: ["Abstract","base","class","for","Patchers","for","various","``","DagRunner","''","s.","These","patcher","classes","``","decorate","''","the","`","run","`","function","of","the","DagRunners",".","The","patcher","can","intercept","arguments","before\/after","the","run","(",")","execution",",","and","even","skip","the","real","run","(",")","execution",".","Users","of","the","patcher","can","read","information","about","the","run","using","`","context","`","which","is","passed","as","a","context","manager","of","patch","(",")",".","For","example",",","the","name","of","the","pipeline","can","be","retrieved","with","`","context","[","DagRunnerPatcher.PIPELINE_NAME","]","`",".","Child","class","should","override","get_runner_class","(",")","to","specify","which","DagRunner","class","they","patch",".","And","they","can","add","more","actions","in","before_run","(",")","\/after_run","(",")","as","they","needed","."]
docstr: Context manager to patch the run function.
  
  Example usage:
    patcher = SomeDagRunnerPatcher()
    with patcher.patch() as context:
      runner.run(pipeline)
      print( context[patcher.PIPELINE_NAME] ) ...
  
  Yields:
    a MutableMapping that holds information on the pipeline.
docstr_tok: ["Context","manager","to","patch","the","run","function",".","Example","usage",":","patcher","=","SomeDagRunnerPatcher","(",")","with","patcher.patch","(",")","as","context",":","runner.run","(","pipeline",")","print","(","context","[","patcher.PIPELINE_NAME","]",")","...","Yields",":","a","MutableMapping","that","holds","information","on","the","pipeline","."]
code: def patch(self):
      """Context manager to patch the run function.
  
      Example usage:
        patcher = SomeDagRunnerPatcher()
        with patcher.patch() as context:
          runner.run(pipeline)
          print( context[patcher.PIPELINE_NAME] ) ...
  
      Yields:
        a MutableMapping that holds information on the pipeline.
      """
  
      runner_class = self.get_runner_class()
      old_run = runner_class.run
      runner_class.run = self._decorate(runner_class.run)
      try:
          yield self._context
      finally:
          runner_class.run = old_run
  
file_path: tfx/tfx/tools/cli/handler/dag_runner_patcher.py
imports: import abc
  import contextlib
  import functools
  from typing import Any, MutableMapping, Type, Union
  from tfx.orchestration import pipeline
  from tfx.orchestration import tfx_runner
  from tfx.orchestration.portable import tfx_runner
  from tfx.proto.orchestration import pipeline_pb2
label_desc: Use image node_id 6 for calling the DagRunnerPatcher obj's underlying member method code with example usage: obj.patch() without return types