Skip to content

Commit

Permalink
Abstract MetricsCollector class
Browse files Browse the repository at this point in the history
This will force people to implement this methods of this class when they
refer to it.
  • Loading branch information
thisiscab committed Dec 13, 2018
1 parent 7756b37 commit 98ad6dc
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion luigi/metrics.py
@@ -1,3 +1,5 @@
import abc

from enum import Enum


Expand All @@ -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

0 comments on commit 98ad6dc

Please sign in to comment.