def getLogger(name=''): """ 返回日志对象 Logger :param name: 配置内的key :return: Logger """ config = Config() logging.config.fileConfig(config.logging_conf) logger = logging.getLogger(name) if name else logging return logger
SfoServerAccessLog, SfoTasksListMethod, SfoManagerTaskLogMethod, db, SfoClusterNodesMethod, SfoCofigureMethod, SfoHostInfoMethod, ) from sfo_server.resource.common import timestamp_format, weight_con, reverse_unit from sfo_server.manager_class import DiskOperation, SwiftServiceOperation, RingManager, PolicyManager, FileManager, ClusterManager, ServiceOperation from apscheduler.schedulers import SchedulerAlreadyRunningError, SchedulerNotRunningError from apscheduler.schedulers.background import BackgroundScheduler from apscheduler.jobstores.sqlalchemy import SQLAlchemyJobStore from apscheduler.executors.pool import ThreadPoolExecutor config = Config() rlock = RLock() # [apscheduler] JOBSTORES_SQL_USER = config.mysql_user JOBSTORES_SQL_PASSWORD = config.mysql_passwd JOBSTORES_SQL_HOST = config.mysql_host JOBSTORES_SQL_PORT = config.mysql_port JOBSTORES_SQL_DBNAME = config.mysql_dbname THREAD_POOL_EXECUTER_NUM = 1 JOB_COALESCE = False JOB_MAX_INSTANCE = 100 apsjob_logger = getLogger('apscheduler.executors.default') jobstores = {
# limitations under the License. import os import shutil from flask import request from sfo_server import manager_class from sfo_server.models import SfoClusterNodesMethod from flask_restful import Resource from sfo_server.resource.common import used_time from configparser import NoSectionError, ConfigParser from collections import OrderedDict from sfo_server import access_logger from sfo_server.decorate import login_required, permission_required from sfo_common.config_parser import Config global_config = Config() def cluster_swift_config_logic(hostname, filename=None): """ :return: """ status = '' message = '' resp = {"status": status, "message": message} host = SfoClusterNodesMethod.query_host_by_host_name(hostname) if not host: raise ValueError('not Node hostname is %s' % hostname) if filename: node_man = manager_class.NodeManager(host.node_inet_ip) content = node_man.swift_config.read_config(