PROJECT_ROOT = path(__file__).abspath().dirname().dirname() VIRTUALENV = path(sys.executable).abspath().dirname().dirname() sys.path.append(PROJECT_ROOT) sys.path.append(PROJECT_ROOT / 'apps') from heartbeat import Heartbeat from what_apps.meta.alerts import local_red_alert import requests HEARTBEATS = Heartbeat.__subclasses__() class HeartBeatRunner(object): error_messages = [] def run(self): for HeartbeatChild in HEARTBEATS: #HeartbeatChild here is a class (a subclass of the Heartbeat class) heartbeat = HeartbeatChild() if not heartbeat.is_skipped(): # try: heartbeat.run() # except Exception, e: # self.error_messages.append(e)
import sys from path import path PROJECT_ROOT = path(__file__).abspath().dirname().dirname() VIRTUALENV = path(sys.executable).abspath().dirname().dirname() sys.path.append(PROJECT_ROOT) sys.path.append(PROJECT_ROOT / 'apps') from heartbeat import Heartbeat from what_apps.meta.alerts import local_red_alert import requests HEARTBEATS = Heartbeat.__subclasses__() class HeartBeatRunner(object): error_messages = [] def run(self): for HeartbeatChild in HEARTBEATS: #HeartbeatChild here is a class (a subclass of the Heartbeat class) heartbeat = HeartbeatChild() if not heartbeat.is_skipped(): # try: heartbeat.run() # except Exception, e: # self.error_messages.append(e)