<s> import os <EOL> import sys <EOL> import threading <EOL> import time <EOL> from synchronizers . base . event_loop import XOSObserver <EOL> from synchronizers . base . event_manager import EventListener <EOL> from xos . logger import Logger , logging <EOL> from synchronizers . model_policy import run_policy <EOL> from xos . config import Config <EOL> logger = Logger ( level = logging . INFO ) <EOL> class Backend : <EOL> def run ( self ) : <EOL> observer = XOSObserver ( ) <EOL> observer_thread = threading . Thread ( target = observer . run ) <EOL> observer_thread . start ( ) <EOL> observer_name = getattr ( Config ( ) , "<STR_LIT>" , "<STR_LIT>" ) <EOL> if ( not observer_name ) : <EOL> model_policy_thread = threading . Thread ( target = run_policy ) <EOL> model_policy_thread . start ( ) <EOL> else : <EOL> model_policy_thread = None <EOL> print "<STR_LIT>" <EOL> while True : <EOL> try : <EOL> time . sleep ( <NUM_LIT:1000> ) <EOL> except KeyboardInterrupt : <EOL> print "<STR_LIT>" <EOL> observer_thread . _Thread__stop ( ) <EOL> if model_policy_thread : <EOL> model_policy_thread . _Thread__stop ( ) <EOL> sys . exit ( <NUM_LIT:1> ) </s>
