예제 #1
0
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()
예제 #2
0
def main():
    # Init framework
    Application({})

    # Run the example code
    book = ReadingBook(content="This is content")
    book.read(respond=lambda result: print(result))
예제 #3
0
    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)
예제 #4
0
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()
예제 #5
0
 def add_method(self, method):
     Application().settings["methods"].append(method)
예제 #6
0
 def add_attribute(self, key, value):
     Application().settings["attributes"].append((key, value))
예제 #7
0
 def add_settings_variable(self, key, value):
     Application().settings[key] = value