Skip to content

Commit

Permalink
Fix Ruff rule B027
Browse files Browse the repository at this point in the history
  • Loading branch information
janasangeetha committed Nov 4, 2024
1 parent 2fe6c5f commit 83abbc0
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion tfx/tools/cli/handler/dag_runner_patcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from tfx.proto.orchestration import pipeline_pb2


class DagRunnerPatcher(abc.ABC):
class ParentDagRunnerPatcher(abc.ABC):
"""Abstract base class for Patchers for various "DagRunner"s.
These patcher classes "decorate" the `run` function of the DagRunners.
Expand Down Expand Up @@ -56,11 +56,13 @@ def __init__(self, call_real_run=True):
self._run_called = False
self._call_real_run = call_real_run

@abc.abstractmethod
def _before_run(self, runner: tfx_runner.TfxRunner,
pipeline: Union[pipeline_pb2.Pipeline, tfx_pipeline.Pipeline],
context: MutableMapping[str, Any]) -> None:
pass

@abc.abstractmethod
def _after_run(self, runner: tfx_runner.TfxRunner,
pipeline: Union[pipeline_pb2.Pipeline, tfx_pipeline.Pipeline],
context: MutableMapping[str, Any]) -> None:
Expand Down Expand Up @@ -135,3 +137,21 @@ def wrapper(*args, **kwargs):
return result

return wrapper

class DagRunnerPatcher(ParentDagRunnerPatcher):
"""The child class for all abstract methods."""

def _before_run(self, runner: tfx_runner.TfxRunner,
pipeline: Union[pipeline_pb2.Pipeline, tfx_pipeline.Pipeline],
context: MutableMapping[str, Any]) -> None:
pass

def _after_run(self, runner: tfx_runner.TfxRunner,
pipeline: Union[pipeline_pb2.Pipeline, tfx_pipeline.Pipeline],
context: MutableMapping[str, Any]) -> None:
pass

def get_runner_class(
self
) -> Union[Type[tfx_runner.TfxRunner], Type[portable_tfx_runner.TfxRunner]]:
raise NotImplementedError()

0 comments on commit 83abbc0

Please sign in to comment.