def __init__(self, config, *args, **kwargs): self.config = config self.parse_config() self._ec2 = boto.ec2.connect_to_region( self.aws_region, aws_access_key_id=self.aws_access_key_id, aws_secret_access_key=self.aws_secret_access_key) self.cache = ResolverCache(self._lookup_wrapper, self.autorefresh) self.log = tx_logging.getLogger("awsdns:resolver") client.Resolver.__init__(self, *args, **kwargs)
def __init__(self, config, *args, **kwargs): self.config = config self.parse_config() self._ec2 = boto.ec2.connect_to_region( self.aws_region, aws_access_key_id=self.aws_access_key_id, aws_secret_access_key=self.aws_secret_access_key ) self.cache = ResolverCache(self._lookup_wrapper, self.autorefresh) self.log = tx_logging.getLogger("awsdns:resolver") client.Resolver.__init__(self, *args, **kwargs)
from commander.sharing import ( shared_storage, KEY_SERVER_RUNNING, KEY_SERVER_NAME, KEY_SERVER_LOCAL_ADDRESS, KEY_SERVER_USER_PORT, KEY_SERVER_CHANNELS, KEY_SERVER_DIFFICULTY, KEY_SERVER_UPDATE_TOKEN, ) from il2ds_difficulty import decompose_difficulty_to_tabs from misc.helpers import current_time_hash LOG = tx_logging.getLogger(__name__) def is_server_running(): """ Tell whether game server is running. Values is read from shared storage. """ return shared_storage.exists(KEY_SERVER_RUNNING) def is_commander_running(): """ Tell whether commander is running. It is considered to be running if information about game server is present in the shared storage or if commander's API socket exists. """
# -*- coding: utf-8 -*- import gtk import tx_logging from il2ds_middleware.constants import MISSION_STATUS from minic.constants import MISSION_STATUS_INFO from minic.models import MissionManager from minic.resources import image_path from minic.service import root_service from minic.settings import user_settings from minic.util import ugettext_lazy as _ LOG = tx_logging.getLogger('ui') def show_message(message, message_type, parent=None): md = gtk.MessageDialog(parent, gtk.DIALOG_DESTROY_WITH_PARENT, message_type, gtk.BUTTONS_CLOSE, unicode(message)) md.run() md.destroy() def show_error(message, parent=None): show_message(message, gtk.MESSAGE_ERROR, parent) class SettingsDialog(gtk.Dialog): def __init__(self, parent): super(SettingsDialog, self).__init__( title=_("Settings"),
def setUp(self): self.LOG = tx_logging.getLogger(__name__) self.log_path = tempfile.mktemp() self.log_file = open(self.log_path, 'w')
# coding: utf-8 __author__ = 'viator' import datetime import collections import types import tx_logging from twisted.internet import defer LOG = tx_logging.getLogger(__name__) def log_timeit(f, *args, **kwargs): pattern_info = kwargs.pop('pattern_info', 'Time for {}: {}'.format(repr(f), '{:.5f}s')) start_time = datetime.datetime.now() result = f(*args, **kwargs) stop_time = datetime.datetime.now() time_info = pattern_info.format( (stop_time - start_time).total_seconds(), ) LOG.info(time_info) return result class IterationWrapper(object): def __init__(self, iterator): self.iterator = iterator
# -*- coding: utf-8 -*- import gtk import tx_logging from il2ds_middleware.constants import MISSION_STATUS from minic.constants import MISSION_STATUS_INFO from minic.models import MissionManager from minic.resources import image_path from minic.service import root_service from minic.settings import user_settings from minic.util import ugettext_lazy as _ LOG = tx_logging.getLogger('ui') def show_message(message, message_type, parent=None): md = gtk.MessageDialog(parent, gtk.DIALOG_DESTROY_WITH_PARENT, message_type, gtk.BUTTONS_CLOSE, unicode(message)) md.run() md.destroy() def show_error(message, parent=None): show_message(message, gtk.MESSAGE_ERROR, parent)
def __init__(self, callback, autorefresh=False): self._cache = {} self.callback = callback self.autorefresh = autorefresh self.log = tx_logging.getLogger("awsdns:cache") self._pending = {}