本文整理汇总了Python中settings.get_logger函数的典型用法代码示例。如果您正苦于以下问题:Python get_logger函数的具体用法?Python get_logger怎么用?Python get_logger使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_logger函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, session=None, server=None):
self.logger = settings.get_logger(settings.LOG, self.__class__.__name__)
self.session = session
self.server = server
self.connect()
self.db = self._conn[self.Meta.db]
self.admin_db = self._conn[settings.ADMIN_DB]
self.collection = self._conn[self.Meta.db][self.Meta.collection]
开发者ID:entone,项目名称:GeriCare,代码行数:8,代码来源:controller.py
示例2: __init__
def __init__(self, port):
self.logger = settings.get_logger(settings.LOG, self.__class__.__name__)
#sockets = tornado.netutil.bind_sockets(port)
#tornado.process.fork_processes(0)
server = tornado.httpserver.HTTPServer(TORNADO_APP)
server.bind(port)
server.start()
settings.startup()
self.logger.debug("Server Started: %s" % port)
tornado.ioloop.IOLoop.instance().start()
开发者ID:entone,项目名称:GeriCare,代码行数:10,代码来源:server.py
示例3: __init__
def __init__(self, view=View, *args, **kwargs):
super(Model, self).__init__(*args, **kwargs)
self.logger = settings.get_logger(settings.LOG, self.__class__.__name__)
self.admin_db = self.__conn__[self.__admindb__]
self.__logs__ = []
self.__view__ = view(context=self) if not self.__currentview__ else self.__currentview__(context=self)
try:
self.init(*args, **kwargs)
except Exception as e:
self.logger.exception(e)
pass
开发者ID:entone,项目名称:GeriCare,代码行数:11,代码来源:model.py
示例4: get_file_config
def get_file_config(filepath):
logger = settings.get_logger('blippd')
try:
with open(filepath) as f:
conf = f.read()
return json.loads(conf)
except IOError as e:
logger.exc('get_file_config', e)
logger.error('get_file_config',
msg="Could not open config file... exiting")
exit(1)
except ValueError as e:
logger.exc('get_file_config', e)
logger.error('get_file_config',
msg="Config file is not valid json... exiting")
exit(1)
开发者ID:prak5190,项目名称:blipp,代码行数:16,代码来源:blippd.py
示例5: main
def main():
"""Run periscope"""
ssl_opts = None
logger = settings.get_logger()
logger.info('periscope.start')
loop = tornado.ioloop.IOLoop.instance()
# parse command line options
tornado.options.parse_command_line()
app = PeriscopeApplication()
if settings.ENABLE_SSL:
ssl_opts = settings.SSL_OPTIONS
http_server = tornado.httpserver.HTTPServer(app, ssl_options=ssl_opts)
http_server.listen(options.port, address=options.address)
loop.start()
logger.info('periscope.end')
开发者ID:ahassany,项目名称:unis,代码行数:18,代码来源:app.py
示例6: main
def main(options=None):
options = get_options() if not options else options
logger = settings.get_logger('blippd', options['--log'], options['--log-level'])
conf = deepcopy(settings.STANDALONE_DEFAULTS)
cconf = {
"id": options.get("--service-id", None),
"name": "blipp",
"properties": {
"configurations": {
"unis_url": options.get("--unis-url", None),
}
}
}
delete_nones(cconf)
merge_dicts(conf, cconf)
if options['--config-file']:
fconf = get_file_config(options['--config-file'])
merge_dicts(conf, fconf)
bconf = BlippConfigure(initial_config=conf,
node_id=options['--node-id'],
pre_existing_measurements=options['--existing'],
urn=options['--urn'])
bconf.initialize()
config = bconf.config
logger.info('main', config=pprint.pformat(config))
logger.warn('NODE: ' + HOSTNAME, config=pprint.pformat(config))
if options['--daemonize']:
with daemon.DaemonContext():
arbiter.main(bconf)
else:
arbiter.main(bconf)
开发者ID:prak5190,项目名称:blipp,代码行数:38,代码来源:blippd.py
示例7: ord
import json
import requests
import sys
import uuid
import os
from stat import ST_MTIME
from multiprocessing import Process, Pipe
from ms_client import MSInstance
from unis_client import UNISInstance
from collector import Collector
from sched_obj import SchedObj, FakeDict
import settings
logger = settings.get_logger("sched")
SETTINGS_FILE = os.path.dirname(__file__) + "/settings.py"
if settings.DEBUG:
for item in dir(settings):
if ord(item[0]) >= 65 and ord(item[0]) <= 90:
logger.debug("settings", item=item, value=str(settings.__getattribute__(item))) # @UndefinedVariable
# loop every check interval:
# check settings file and reload
# check probe_settings files and add to probes_reload if changed
# loop probes:
# does it have a process?
# no: create and start it
# yes: is it not alive?
# join it check exit code
开发者ID:ahassany,项目名称:blipp,代码行数:31,代码来源:sched.py
示例8: __init__
import settings
import shlex
import dateutil.parser
import calendar
import re
logger = settings.get_logger("netlogger_probe")
class Probe:
def __init__(self, service, measurement):
self.config = measurement["configuration"]
self.logfile = None
try:
self.logfile = open(self.config["logfile"])
except KeyError:
logger.warn("__init__", msg="Config does not specify logfile!")
except IOError:
logger.warn("__init__", msg="Could not open logfile: %s" % self.config["logfile"])
self.app_name = self.config.get("appname", "")
self.et_string = "ps:tools:blipp:netlogger:"
if self.app_name:
self.et_string += self.app_name + ":"
def get_data(self):
if self.logfile:
ret = []
self.logfile.seek(self.logfile.tell())
for line in self.logfile:
if "VAL" not in line:
开发者ID:prak5190,项目名称:blipp,代码行数:31,代码来源:netlogger_probe.py
示例9: __init__
import settings
import time
import socket
from collector import Collector
from utils import blipp_import
import pprint
HOSTNAME = socket.gethostname()
logger = settings.get_logger('probe_runner')
rtt_list = []
collect_rtt_list = []
class ProbeRunner:
'''
Class to handle a single probe. Creates the scheduler, collector,
and probe module associated with this probe. The run method should
be called as a subprocess (by arbiter) and passed a
connection object so that it can receive a "stop" if necessary.
'''
def __init__(self, service, measurement):
self.measurement = measurement
self.config = measurement['configuration']
self.service = service.config
self.probe_defaults = service.probe_defaults
self.setup()
def run(self, conn, ip):
if conn.poll() and conn.recv() == "stop":
self._cleanup()
exit()
开发者ID:kdevakum,项目名称:alto-on-unis,代码行数:31,代码来源:probe_runner.py
示例10: __init__
from ms_client import MSInstance
from data_logger import DataLogger
from unis_client import UNISInstance
import settings
logger = settings.get_logger("collector")
class Collector:
"""Collects reported measurements and aggregates them for
sending to MS at appropriate intervals.
Also does a bunch of other stuff which should probably be handled by separate classes.
Creates all the metadata objects, and the measurement object in UNIS for all data inserted.
Depends directly on the MS and UNIS... output could be far more modular.
"""
def __init__(self, service, measurement):
self.config = measurement["configuration"]
self.service = service
self.measurement = measurement
self.collections_created = False
self.ms = MSInstance(service, measurement)
self.dl = DataLogger(service, measurement)
self.mids = {} # {subject1: {metric1:mid, metric2:mid}, subj2: {...}}
# {mid: [{"ts": ts, "value": val}, {"ts": ts, "value": val}]}
self.mid_to_data = {}
self.mid_to_et = {}
self.unis = UNISInstance(service)
self.num_collected = 0
开发者ID:prak5190,项目名称:blipp,代码行数:30,代码来源:collector.py
示例11: ServiceConfigure
from unis_client import UNISInstance
import settings
import pprint
from utils import merge_dicts
logger = settings.get_logger('conf')
class ServiceConfigure(object):
'''
ServiceConfigure is meant to be a generic class for any service
which registers itself to, and gets configuration from UNIS. It
was originally developed for BLiPP, but BLiPP specific features
should be in the BlippConfigure class which extends
ServiceConfigure.
'''
def __init__(self, initial_config={}, node_id=None, urn=None):
if not node_id:
node_id = settings.UNIS_ID
self.node_id = node_id
self.urn = urn
self.config = initial_config
self.unis = UNISInstance(self.config)
self.service_setup = False
def initialize(self):
self._setup_node(self.node_id)
self._setup_service()
def refresh(self):
r = self.unis.get("/services/" + self.config["id"])
开发者ID:kdevakum,项目名称:alto-on-unis,代码行数:31,代码来源:conf.py
示例12: Technologies
# license. See the COPYING file for details.
#
# This software was created at the Indiana University Center for Research in
# Extreme Scale Technologies (CREST).
# =============================================================================
'''
Server for blipp configuration and control via cmd line interface.
'''
import zmq
import settings
import json
import time
from config_server_api import RELOAD, GET_CONFIG, POLL_CONFIG
logger = settings.get_logger('config_server')
class ConfigServer:
def __init__(self, conf_obj):
self.context = zmq.Context()
self.conf_obj = conf_obj
self.changed = True
self.socket = self.context.socket(zmq.REP)
self.socket.bind("ipc:///tmp/blipp_socket_zcWcfO0ydo")
def listen(self, timeout):
cur_time = time.time()
finish_time = cur_time + timeout
while cur_time < finish_time:
logger.info("listen", msg="polling for %d"%(finish_time-cur_time))
if self.socket.poll((finish_time - cur_time)*1000):
开发者ID:periscope-ps,项目名称:blipp,代码行数:31,代码来源:config_server.py
示例13: __init__
from blipp_conf import BlippConfigure
import settings
import arbiter
from utils import merge_dicts, delete_nones
FIELD_LEN = 10
VERSION = "0.0.1"
REQUEST_TYPE = "1"
MESSAGE_LEN = 512
MAX_HOST_LEN = 256
SUCCESS = 1
FAILURE = 2
HOSTNAME = socket.gethostname()
logger = settings.get_logger('ablippd')
iplist = []
class LboneServer:
def __init__(self, host, port):
self.host = host
self.port = int(port)
def GetDepot(self, numDepots, hard, soft, duration, location, timeout):
str_final_req = []
str_final_req.append(self.PadField(VERSION))
str_final_req.append(self.PadField(REQUEST_TYPE))
str_final_req.append(self.PadField(str(numDepots)))
str_final_req.append(self.PadField(str(hard)))
开发者ID:kdevakum,项目名称:alto-on-unis,代码行数:30,代码来源:alto_1.py
示例14: check_ffmpeg
#!/usr/bin/env python
'''
Creates image with size settings.THUMBNAIL_WIDTH, settings.THUMBNAIL_HEIGHT for
each video file.
'''
import os
import shutil
import subprocess
import sys
_CURRENT_DIR = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(_CURRENT_DIR, '..'))
import settings # pylint: disable=import-error, wrong-import-position
log = settings.get_logger('create_video_thumbnails') # pylint: disable=invalid-name
def check_ffmpeg():
'''
Checks that ffmpeg is available.
:return: True if ffmpeg has been found, False otherwise.
'''
try:
subprocess.check_call(['ffmpeg', '-version'])
except subprocess.CalledProcessError:
return False
return True
def get_video_files_list(path):
开发者ID:weisert,项目名称:mpsb,代码行数:31,代码来源:create_video_thumbnails.py
示例15: Technologies
#
# This software may be modified and distributed under the terms of the BSD
# license. See the COPYING file for details.
#
# This software was created at the Indiana University Center for Research in
# Extreme Scale Technologies (CREST).
# =============================================================================
import time
import settings
from probe_runner import ProbeRunner
from multiprocessing import Process, Pipe
from copy import copy
from config_server import ConfigServer
import pprint
logger = settings.get_logger('arbiter')
PROBE_GRACE_PERIOD = 10
class Arbiter():
'''
The arbiter handles all of the Probes. It reloads the config every
time the unis poll interval comes around. If new probes have been
defined or if old probes removed, it starts and stops existing
probes.
Each probe is run by the ProbeRunner class in a separate
subprocess. The arbiter has a dictionary which contains the
process object for each probe, and the connection object to that
process. The arbiter can send a "stop" string through the
connection to give a probe the chance to shut down gracefully. If
开发者ID:periscope-ps,项目名称:blipp,代码行数:31,代码来源:arbiter.py
示例16: expire
#!/usr/bin/python
# Go through all the groups, expiring articles that have exceeded
# their lifetime.
import os, time
import settings, group
logger = settings.get_logger('pnntprss.expire')
def expire(g):
"""Expire articles in the given group."""
if not g.lockfile.trylock():
# we are already updating, expiring, or otherwise messing with
# this group. No problem, we'll try again next time round.
return
try:
lifetime = g.config.get('article_lifetime', settings.article_lifetime)
if lifetime:
now = time.time()
to_remove = set()
for art in g.article_numbers():
stat = os.stat(g.article_file(art))
if now - stat.st_mtime > lifetime:
to_remove.add(art)
if to_remove:
开发者ID:dpw,项目名称:pnntprss,代码行数:31,代码来源:expire.py
示例17: get_logger
# pridame lokalni knihovny
sys.path.append(os.path.join(os.path.split(os.path.dirname(os.path.abspath(__file__)))[0],'lib','python2.7'))
sys.path.append(os.path.join(os.path.split(os.path.dirname(os.path.abspath(__file__)))[0],'etc'))
if 'XML_catalog_files' in os.environ:
os.environ['XML_CATALOG_FILES'] = os.environ['XML_CATALOG_FILES'] + " " + os.path.join(os.path.split(os.path.dirname(os.path.abspath(__file__)))[0],'lib','schema','catalog.xml')
else:
os.environ['XML_CATALOG_FILES'] = os.path.join(os.path.split(os.path.dirname(os.path.abspath(__file__)))[0],'lib','schema','catalog.xml')
from directories import WorkDir
from psp import PSP
from validator import Validator
from settings import workdir, get_logger, get_file_log_handler
import logging
# http://www.cafeconleche.org/books/effectivexml/chapters/47.html
logger = get_logger()
parser = argparse.ArgumentParser(description="""Program validuje PSP balicky.
Umi validovat na trech urovnich:
- METS soubor
- hodnoty z ciselniku existuji
- linky, na ktere se v balicku odkazuje existuji
Kazda z techto voleb se da vypnout.
Program rozbali zadany/zadane PSP balicek/balicky do adresare %s
Pokud je zadany adresar, tak ho bere jako rozbaleny PSP balicek
a pokusi se je zkontrolovat.
Pokud se pri kontrole souboru v adresari amdSec, ... objevi chyba,
开发者ID:edeposit,项目名称:psp-validator,代码行数:31,代码来源:validate-psp.py
示例18: Copyright
# periscope-ps (blipp)
#
# Copyright (c) 2013-2016, Trustees of Indiana University,
# All rights reserved.
#
# This software may be modified and distributed under the terms of the BSD
# license. See the COPYING file for details.
#
# This software was created at the Indiana University Center for Research in
# Extreme Scale Technologies (CREST).
# =============================================================================
import settings
from utils import get_most_recent
from periscope_client import PeriscopeClient
logger = settings.get_logger('unis_client')
class UNISInstance:
def __init__(self, service):
self.service = service
self.config = service["properties"]["configurations"]
unis_url=self.config["unis_url"]
if unis_url and unis_url[-1]=="/":
unis_url = unis_url[:-1]
self.pc = PeriscopeClient(service, unis_url)
self.meas_to_mds = {}
def post(self, url, data={}):
return self.pc.do_req('post', url, data)
def get(self, url, data=None):
开发者ID:periscope-ps,项目名称:blipp,代码行数:31,代码来源:unis_client.py
示例19: Copyright
# Copyright (c) 2013-2016, Trustees of Indiana University,
# All rights reserved.
#
# This software may be modified and distributed under the terms of the BSD
# license. See the COPYING file for details.
#
# This software was created at the Indiana University Center for Research in
# Extreme Scale Technologies (CREST).
# =============================================================================
import http
import json
import settings
import re
from requests.exceptions import ConnectionError
logger = settings.get_logger('periscope_client')
class PeriscopeClient:
def __init__(self, service_entry, url):
self.service_entry = service_entry
self.config = service_entry["properties"]["configurations"]
self.url = url
def do_req(self, rtype, url, data=None, headers=None):
config = self.config
url, schema, dheaders = self._url_schema_headers(url)
headers = dheaders if not headers else headers
if isinstance(data, dict):
if schema:
data.setdefault('$schema', schema)
if rtype=='post' or rtype=='put':
开发者ID:periscope-ps,项目名称:blipp,代码行数:31,代码来源:periscope_client.py
示例20: __init__
from ms_client import MSInstance
from data_logger import DataLogger
from unis_client import UNISInstance
import settings
logger = settings.get_logger('collector')
class Collector:
"""Collects reported measurements and aggregates them for
sending to MS at appropriate intervals.
Also does a bunch of other stuff which should probably be handled by separate classes.
Creates all the metadata objects, and the measurement object in UNIS for all data inserted.
Depends directly on the MS and UNIS... output could be far more modular.
"""
def __init__(self, service, measurement):
self.config = measurement["configuration"]
self.service = service
self.measurement = measurement
self.collections_created = False
self.ms = MSInstance(service, measurement)
self.dl = DataLogger(service, measurement)
self.mids = {} # {subject1: {metric1:mid, metric2:mid}, subj2: {...}}
# {mid: [{"ts": ts, "value": val}, {"ts": ts, "value": val}]}
self.mid_to_data = {}
self.mid_to_et = {}
self.unis = UNISInstance(service)
self.num_collected = 0
def insert(self, data, ts):
'''
开发者ID:kdevakum,项目名称:alto-on-unis,代码行数:31,代码来源:collector.py
注:本文中的settings.get_logger函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论