Exemplo n.º 1
0
def get_server():
    '''
    현재의 Python Interpreter 에서 접속한 백엔드와 교신하게 해 준다.
    Warara 코드 전반에서 사용된다.
    '''
    global server
    if not server:
        if warara_settings.SERVER_TYPE == 'THRIFT':
            server = Server(ARARA_SERVER_HOST, ARARA_SERVER_BASE_PORT)
        elif warara_settings.SERVER_TYPE == 'DIRECT':
            # Set logger
            # XXX(hodduc): Thrift server와 arara_settings를 참조하지 않는 방향으로 고치면 더 좋을 듯
            # bin/thrift_arara_server.py와 middleware/thrift_server.py에서 해당 부분을 분리해낼 필요가 있음
            from middleware.thrift_server import set_default_log_handlers
            from etc import arara_settings
            set_default_log_handlers(arara_settings.ARARA_LOG_PATH,
                                     arara_settings.ARARA_DEBUG_HANDLER_ON,
                                     arara_settings.ARARA_DEBUG_LOG_PATH)
            logger = logging.getLogger('main')

            # Get Engine
            from arara import arara_engine
            from arara import model
            model.init_database()
            server = arara_engine.ARAraEngine()
        else:
            raise ValueError("Invalid Value for warara_settings.SERVER_TYPE")
    return server
Exemplo n.º 2
0
    def __init__(self):
        self.engine = arara_engine.ARAraEngine()

        self.sysop_session_key = self.engine.login_manager.login(u'SYSOP', u'SYSOP', u'127.0.0.1')
        self.username_list = []
        self.board_name_list = []
        self.article_number_list = []
        self.session_key_list = []
Exemplo n.º 3
0
    def setUp(self):
        super(WararaTestBase, self).setUp()

        # TEST 용 Backend 생성
        model.init_test_database()
        self.arara_engine = arara_engine.ARAraEngine()
        warara_middleware.set_server(self.arara_engine)
        self.client = Client()
Exemplo n.º 4
0
def main():
    model.init_test_database()
    interface_class = ARAraThriftInterface.Iface
    handler_instance = arara_engine.ARAraEngine()

    interface_method_name_list = [
        x[0] for x in inspect.getmembers(interface_class,
                                         predicate=inspect.ismethod)
    ]
    handler_method_name_list = [
        x[0] for x in inspect.getmembers(handler_instance,
                                         predicate=inspect.ismethod)
    ]

    engine_miss_api = [
        x for x in interface_method_name_list
        if not x in handler_method_name_list and not x in ['__init__']
    ]
    api_miss_engine = [
        x for x in handler_method_name_list
        if not x in interface_method_name_list and not x in ['__init__']
    ]

    if engine_miss_api:
        print " * ARAraEngine misses several functions defined in Thrift Interface"
        print
        for function in engine_miss_api:
            print "    ", function
        print

    if api_miss_engine:
        print " * Thrift Interface misses several functions defined in ARAraEngine"
        print
        for function in api_miss_engine:
            print "    ", function
        print
Exemplo n.º 5
0
'''
ARAraEngine 객체를 생성하고, 디버깅에 유용한 모듈들을 import 한다.
디버깅 편의를 위해 global namespace 에 arara_engine 이라는 인스턴스를 생성.

USAGE:

    $ python -i direct_arara_engine_loader.py

    >>> s = arara_engine.login_manager.login(u"SYSOP", u"SYSOP", "127.0.0.1")
    >>> print_memory_allocated()

tools/memory_inspector.py 를 사용한다.
tools/sqlalchemy_debugger.py 도 사용한다.
'''
import os
import sys

THRIFT_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'gen-py'))
ARARA_PATH  = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
sys.path.append(THRIFT_PATH)
sys.path.append(ARARA_PATH)

from arara import arara_engine
from arara import model

from tools.memory_inspector import print_memory_allocated
from tools.sqlalchemy_debugger import compile_query

model.init_database()
arara_engine = arara_engine.ARAraEngine()