def getClientServicesConfig(manager): import account_helpers import connection_mgr import gui import helpers from skeletons.connection_mgr import IConnectionManager manager.addInstance(IConnectionManager, connection_mgr.ConnectionManager(), finalizer='fini') manager.addConfig(account_helpers.getAccountHelpersConfig) manager.addConfig(gui.getGuiServicesConfig) manager.addConfig(helpers.getHelperServicesConfig)
def getClientServicesConfig(manager): """ Configures services on client. :param manager: helpers.dependency.DependencyManager """ import account_helpers import connection_mgr import gui import helpers from skeletons.connection_mgr import IConnectionManager manager.addInstance(IConnectionManager, connection_mgr.ConnectionManager(), finalizer='fini') manager.addConfig(gui.getGuiServicesConfig) manager.addConfig(account_helpers.getAccountHelpersConfig) manager.addConfig(helpers.getHelperServicesConfig)
def getClientServicesConfig(manager): import account_helpers import connection_mgr import MapActivities import dyn_objects_cache import gui import gameplay import helpers import uilogging import festivity from vehicle_systems.appearance_cache import AppearanceCache from skeletons.connection_mgr import IConnectionManager from skeletons.map_activities import IMapActivities from skeletons.dynamic_objects_cache import IBattleDynamicObjectsCache from skeletons.vehicle_appearance_cache import IAppearanceCache manager.addInstance(IConnectionManager, connection_mgr.ConnectionManager(), finalizer='fini') manager.addInstance(IMapActivities, MapActivities.MapActivities(), finalizer='destroy') manager.addInstance(IBattleDynamicObjectsCache, dyn_objects_cache.BattleDynamicObjectsCache(), finalizer='destroy') manager.addInstance(IAppearanceCache, AppearanceCache(), finalizer='clear') manager.addConfig(account_helpers.getAccountHelpersConfig) manager.addConfig(gameplay.getGameplayConfig) manager.addConfig(festivity.getFestivityConfig) manager.addConfig(gui.getGuiServicesConfig) manager.addConfig(uilogging.getUILoggingConfig) manager.addConfig(helpers.getHelperServicesConfig) import constants from gui import GUI_SETTINGS if constants.IS_TUTORIAL_ENABLED and GUI_SETTINGS.isGuiEnabled(): try: import tutorial except ImportError: _logger.exception('Module tutorial not found') from helpers import tutorial else: from helpers import tutorial manager.addConfig(tutorial.getTutorialConfig)
def getClientServicesConfig(manager): import account_helpers import connection_mgr import MapActivities import gui import gameplay import helpers from skeletons.connection_mgr import IConnectionManager from skeletons.map_activities import IMapActivities manager.addInstance(IConnectionManager, connection_mgr.ConnectionManager(), finalizer='fini') manager.addInstance(IMapActivities, MapActivities.MapActivities(), finalizer='destroy') manager.addConfig(account_helpers.getAccountHelpersConfig) manager.addConfig(gameplay.getGameplayConfig) manager.addConfig(gui.getGuiServicesConfig) manager.addConfig(helpers.getHelperServicesConfig)
def getClientServicesConfig(manager): import account_helpers import connection_mgr import MapActivities import dyn_objects_cache import gui import gameplay import helpers from skeletons.connection_mgr import IConnectionManager from skeletons.map_activities import IMapActivities from skeletons.dynamic_objects_cache import IBattleDynamicObjectsCache manager.addInstance(IConnectionManager, connection_mgr.ConnectionManager(), finalizer='fini') manager.addInstance(IMapActivities, MapActivities.MapActivities(), finalizer='destroy') manager.addInstance(IBattleDynamicObjectsCache, dyn_objects_cache.BattleDynamicObjectsCache(), finalizer='destroy') manager.addConfig(account_helpers.getAccountHelpersConfig) manager.addConfig(gameplay.getGameplayConfig) manager.addConfig(festivity.getFestivityConfig) manager.addConfig(gui.getGuiServicesConfig) manager.addConfig(helpers.getHelperServicesConfig)
def __init__(self, dev=False, stage_host=None): ml.ld("Initing Context {0}", id(self)) self.config = None #UFORK STUFF self.num_workers = max(cpu_count() - 1, 2) self.worker_memlimit = 2**30 # used in python as num_children # read from opscfg as max_connections self.pid = None self.process_group_file_path = '' #ASYNC RELATED STUFF self.exception_traces = WeakKeyDictionary() self.thread_locals = threading.local() self.cpu_thread_enabled = True self.cal = None # TODO self.log = log.LoggingContext() # recent stuff self.recent = cache.DefaultLRU(4096, lambda: deque(maxlen=1024)) self.recent['network'] = cache.DefaultLRU(512, lambda: deque(maxlen=100)) #PROTECTED RELATED STUFF self.protected = None import connection_mgr self.connection_mgr = connection_mgr.ConnectionManager() self.user = getpass.getuser() self._dev = dev self._debug_errors = False self.start_browser = False # whether to start a browser pointed at meta on server startup #NETWORK RELATED STUFF self.max_concurrent_clients = 1000 if dev: self.datacenter_connect_timeout = 1.0 # for stages else: self.datacenter_connect_timeout = 0.05 self.client_sockets = WeakKeyDictionary() self.server_group = None self.ip = "127.0.0.1" self.hostname = socket.gethostname() self.fqdn = socket.getfqdn() self.name_cache = {} try: self.ip = socket.gethostbyname(self.hostname) except socket.error: try: self.ip = get_ip_from_hosts() except: for hostname, port in [("github.paypal.com", 80)]: try: # TODO: more hostname / ports to connect to addr = socket.gethostbyname(hostname), port conn = socket.create_connection(addr) self.ip = conn.getsockname()[0] conn.close() break except socket.error: pass self.ops_config = None # TODO self.opscfg_revmap = {} self.address_aliases = {} self._serve_ufork = None self._serve_daemon = None self._wsgi_middleware = None # whether or not dev mode servers should make client certs optional self.ssl_client_cert_optional_in_dev = True self.dev_service_repl_enabled = False self.dev_cal_print_logs = True self.dev_use_reloader = False # whether a greenlet REPL should be started when a server is run in dev mode self.cryptoclient_ping_time_secs = 180 self.sockpool_enabled = True # print on bad log msgs or not # (If bad due to load, sholdn't print # if bad fmt string, should print self.log_failure_print = True # set to false in post fork #MONITORING DATA self.stats = defaultdict(faststat.Stats) self.durations = defaultdict(faststat.Duration) self.intervals = defaultdict(faststat.Interval) self.markov_stats = defaultdict(faststat.Markov) self.volatile_stats = cache.DefaultLRU(2048, faststat.Stats) self.sketches = defaultdict(StreamSketch) self.profiler = None # sampling profiler self.stopping = False self.sys_stats_greenlet = None self.monitor_interval = 0.1 # ~10x per second self.set_greenlet_trace(True) # histogram of CPU runs self.set_monitoring_greenlet(True) # monitor queue depths # CLIENT BEHAVIORS self.mayfly_client_retries = 3 # Are we up yet as a server? self.running = False self.accept_queue_maxlen = 128