def main(): queue = PriorityQueue() for x in range(WORKERS): w = Worker(queue) w.start() settings = {"unblock_workers": 5} Application(settings) PyMongoDriver(host="127.0.0.1", port=27017, user="******", password="******", database="pipeline").register() test = False if test: FrameworkTest().run() # FrameworkTestThread().start() else: port = 9999 StreamManagement(port) web_api = Web(port) web_api.start() Terminal().start()
def main(): # Init framework Application({}) # Run the example code book = ReadingBook(content="This is content") book.read(respond=lambda result: print(result))
def __init__(self): if issubclass(self.__class__, Thread): Thread.__init__(self) if not hasattr(self, "context"): self.context = None else: if self.context is not None: logging.getLogger('system').debug("Initializing context "+self.context) Application().register_object(self)
def main(): settings = { "unblock_workers": 0 } Application(settings) PyMongoDriver( host="127.0.0.1", port=27017, user="******", password="******", database="pipeline").register() icecast = IcecastHandler() icecast.parse_icecastxml("/etc/icecast2/icecast.xml") icecast.update_from_icecast() icecast.register_streams(icecast.get_streams()) web = Web(8888, icecast) web.run()
def add_method(self, method): Application().settings["methods"].append(method)
def add_attribute(self, key, value): Application().settings["attributes"].append((key, value))
def add_settings_variable(self, key, value): Application().settings[key] = value