def __init__(self, venue): """initialization.""" self.venue_name = venue['venue'] self.venue_url = venue['url'] self.acronym = venue['acronym'] self.xml = None super(Venues, self).__init__(['publications']) self.log = Logger.get_logger(auxi.get_fullname(self))
def __init__(self): self.db_adapter = DBAdapter() self.logger = Logger.get_logger(__name__) self.db_connection = self.db_adapter.get_db_connection() self.kafka_consumer_group_id = "lime_bike_trip_movement_analyzer_consumer" self.lime_bike_trips = LimeBikeTrips(self.db_connection) self.kafka_consumer = self.kafka_adapter.get_consumer( topic=self.lime_bike_trips_kafka_topic, group_id=self.kafka_consumer_group_id, )
def get_logger(log_name, verbose=False): log_dir = os.environ['LOG_DIR'] log_path = os.path.join(log_dir, log_name) if verbose: stream_level = logging.DEBUG else: stream_level = logging.INFO file_level = logging.DEBUG return Logger.get_logger(base_level=stream_level, stream_level=stream_level, file_level=file_level, file_path=log_path)
def __init__(self): self.db_adapter = DBAdapter() self.kafka_adapter = KafkaAdapter() self.logger = Logger.get_logger(__name__) self.db_connection = self.db_adapter.get_db_connection() self.lime_bike_feed = LimeBikeFeed(self.db_connection) self.lime_bike_trips_analyze = LimeBikeTripsAnalyze(self.db_connection) self.lime_bike_trips_kafka_topic = Constants.KAFKA_LIME_BIKE_TRIP_TOPIC self.kafka_consumer_group_id = "lime_bike_trip_consumer" self.kafka_consumer = self.kafka_adapter.get_consumer( topic=self.lime_bike_trips_kafka_topic, group_id=self.kafka_consumer_group_id, ) self.kafka_producer = self.kafka_adapter.get_producer() self.lime_bike_trip_analyze_kafka_topic = Constants.KAFKA_LIME_BIKE_TRIP_ANALYZE_TOPIC
# Copyright (c) 2017 www.drcubic.com, Inc. All Rights Reserved # """ File: OracleConn.py Author: shileicao([email protected]) Date: 17/11/2017 8:11 PM """ from utils import Logger import cx_Oracle import traceback import ConfigParser import os Logger = Logger.Logger() logger = Logger.get_logger() os.environ['NLS_LANG'] = 'SIMPLIFIED CHINESE_CHINA.UTF8' class OracleConn(object): def __init__(self, db_url='url_his'): try: cf = ConfigParser.ConfigParser() cf.read('config/config.conf') url = cf.get('oracle', db_url) self.conn = cx_Oracle.connect(url) except Exception: logger.error('连接oracke数据库失败!') traceback.print_exc()
from model import Client from plugins import DiskUsage from remote import Remote from utils import Logger, get_sha1, getenv_path # logging.getLogger("asyncio").setLevel(logging.INFO) RTR_CERT_PATH = getenv_path('RTR_CERT_PATH', './cert/cert.pem') RTR_RETR_INTERVAL = int(os.getenv('RTR_RETR_INTERVAL', 5)) RTR_SHORT_CACHE_TTL = int(os.getenv('RTR_SHORT_CACHE_TTL', 5)) RTR_LISTEN_HOST = os.getenv('RTR_LISTEN_HOST', '127.0.0.1') RTR_LISTEN_PORT = int(os.getenv('RTR_LISTEN_PORT', 8765)) RTR_SECRET_KEY_SHA1 = getenv_path('RTR_SECRET_KEY_SHA1', get_sha1('abc123')) SOCK_PATH = getenv_path('RTR_SCGI_SOCKET_PATH', './.rtorrent.sock') RTR_PID_PATH = getenv_path('RTR_PID_PATH', './wss_server.pid') RTR_PLUGINS_DISK_USAGE_PATHS = os.getenv('RTR_PLUGINS_DISK_USAGE_PATHS', '/') logger = Logger.get_logger() RTR_VERSION = '__RTR_VERSION_PLACEHOLDER__' class Cached: VIEW_DEFAULT = 'main' VIEW_NAME = 'name' VIEWS = { VIEW_DEFAULT, VIEW_NAME, 'started', 'stopped', 'complete', 'incomplete', 'hashing', 'seeding', 'leeching', 'active' } global_data = None global_data_lock = asyncio.Lock() torrents = None torrents_lock = asyncio.Lock() clients = set()
# -*- coding: utf-8 -*- # @Author : nJcx # @Email : [email protected] from elasticsearch import Elasticsearch from settings import es_ip, es_port, ip_list from utils import Logger import xmltodict import os import threading import time import json logger = Logger.get_logger(__name__, path=os.getcwd()) es = Elasticsearch([{'host': es_ip, 'port': es_port}]) def xml_to_json(path): try: with open(path, 'r') as load_f: temp_ = xmltodict.parse(load_f).get("nmaprun") return { key: temp_[key] for key in temp_ if key not in ["verbose", 'scaninfo', 'taskbegin', 'taskend', "debugging"] } except Exception as e: logger.error(str(e) + path) return {}
def __init__(self, processor, poll_timeout_ms=10000, commit=True): self.poll_timeout_ms = poll_timeout_ms self.processor = processor self.commit = commit self.logger = Logger.get_logger(__name__)