From 98ad6dc6b04cc81818ee1ff84806cbb7b7098fdd Mon Sep 17 00:00:00 2001 From: Charles-Andre Bouffard Date: Thu, 13 Dec 2018 10:26:55 -0500 Subject: [PATCH] Abstract MetricsCollector class This will force people to implement this methods of this class when they refer to it. --- luigi/metrics.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/luigi/metrics.py b/luigi/metrics.py index 1ad45325e2..31cc61ff74 100644 --- a/luigi/metrics.py +++ b/luigi/metrics.py @@ -1,3 +1,5 @@ +import abc + from enum import Enum @@ -17,21 +19,27 @@ def get(cls, which): raise ValueError("MetricsCollectors value ' {0} ' isn't supported", which) -class MetricsCollector(object): +class MetricsCollector(abc.ABC): """Dummy MetricsCollecter base class that can be replace by tool specific implementation. """ + + @abc.abstractmethod def __init__(self): pass + @abc.abstractmethod def handle_task_started(self, task): pass + @abc.abstractmethod def handle_task_failed(self, task): pass + @abc.abstractmethod def handle_task_disabled(self, task, config): pass + @abc.abstractmethod def handle_task_done(self, task): pass