From 7a03b73f331cd47be63ce55643cd884c9cf32b40 Mon Sep 17 00:00:00 2001 From: Martin Czygan Date: Thu, 12 Mar 2020 14:54:15 +0100 Subject: workers: add explicit process to base class As per https://docs.python.org/3/library/exceptions.html#NotImplementedError > In user defined base classes, abstract methods should raise this exception when they require derived classes to override the method [...]. --- python/sandcrawler/workers.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'python') diff --git a/python/sandcrawler/workers.py b/python/sandcrawler/workers.py index c290421..54bd581 100644 --- a/python/sandcrawler/workers.py +++ b/python/sandcrawler/workers.py @@ -52,6 +52,12 @@ class SandcrawlerWorker(object): print("Worker: {}".format(self.counts), file=sys.stderr) return self.counts + def process(self, task): + """ + Derived workers need to implement business logic here. + """ + raise NotImplementedError('implementation required') + class MultiprocessWrapper(SandcrawlerWorker): def __init__(self, worker, sink, jobs=None): -- cgit v1.2.3