def __init__(self, config: Config): self.__queue_repository = QueueRepository() # type: QueueRepository self.__obj_hst_repository = ObjectHistoryRepository( ) # type: ObjectHistoryRepository self.__get_executing_lock = Lock() self.__logger = get_logger() self.__config = config
Returns None if it cannot find one.""" try: return socket.gethostbyname(hostname) except socket.gaierror: return None def divide_array(array, num): """Divides the given array into num disjoint ones.""" ret = [] for i in range(num): N = math.ceil(len(array)/num) ret.append( array[i*N : (i+1)*N] ) return ret ######################################################################## if __name__=="__main__": log = get_logger("main") if len(sys.argv) != 2: print("Usage: "+sys.argv[0]+" host_list") sys.exit(0) log.info("Reading in the host list...") # read in the file to process host_list = load_host_list(sys.argv[1]) for hostname, ip in host_list: print(hostname+" "+ip)
from uuid import uuid4 from LoadHandler import LoadHandler from ObjectQueue import ObjectQueue, QueueRepository from main import get_logger from config import get_config from apscheduler.executors.pool import ThreadPoolExecutor from apscheduler.schedulers.background import BlockingScheduler from apscheduler.jobstores.sqlalchemy import SQLAlchemyJobStore config = get_config() def_logger = get_logger() queue = ObjectQueue(config) load_handler = LoadHandler(def_logger, config) jobStores = { 'default': SQLAlchemyJobStore(url='postgresql://{}:{}@{}:5432/{}'.format( config.sched_db.user, config.sched_db.password, config.sched_db.host, config.sched_db.database )) } executors = { 'default': ThreadPoolExecutor(32) }
Returns None if it cannot find one.""" try: return socket.gethostbyname(hostname) except socket.gaierror: return None def divide_array(array, num): """Divides the given array into num disjoint ones.""" ret = [] for i in range(num): N = math.ceil(len(array) / num) ret.append(array[i * N:(i + 1) * N]) return ret ######################################################################## if __name__ == "__main__": log = get_logger("main") if len(sys.argv) != 2: print("Usage: " + sys.argv[0] + " host_list") sys.exit(0) log.info("Reading in the host list...") # read in the file to process host_list = load_host_list(sys.argv[1]) for hostname, ip in host_list: print(hostname + " " + ip)
) mapper(Question, comments_table) metadata.create_all(engine) return sessionmaker(bind=engine) Session = get_session_factory() session = Session() query = session.query(Question) from main import get_logger logger = get_logger('gatherer') import requests def search_questions(title, body): page = 1 questions = list() while True: params = { 'site': 'ru.stackoverflow', 'nottagged': 'исключения',
def setUpClass(cls): cls.logger = get_logger()