Files
brewpi/tasks/task.py
T
jens 6e7f8c2c59 - removed AtemperatureSensor::process
- task is AttributeChange
- hareden against Tempsensor exceptions
2021-10-19 11:29:11 +02:00

29 lines
483 B
Python

import abc
import asyncio
from utils.value import AttributeChange
class ATask(AttributeChange):
def __init__(self, interval):
AttributeChange.__init__(self)
self.interval = interval
@abc.abstractmethod
def on_process(self):
pass
class TaskManager:
def __init__(self):
self.tasks = []
def add(self, task: ATask):
self.tasks.append(task)
def start(self):
funcs = []
for task in self.tasks:
funcs.append(task.on_process())
return asyncio.gather(*funcs)