settings module¶
配置
date: | 2014-12-26 |
---|---|
author: | 刘雪彦 <lxy@hesong.net> |
- settings.EXECUTOR_CONFIG = {'queue_maxsize': 1000, 'pool_maxtasksperchild': 1000, 'pool_processes': 1}¶
执行器设置
这个设置被用于 executor.Executor 构造函数的传入参数。
参数: - queue_maxsize – 任务队列最大值。0,表示无限制。
- pool_processes – 执行器池的最大数量。 None 表示使用 CPU 核心数量作为其最大值。
- pool_maxtasksperchild – 进程池最大执行数量。 None 表示无限制。超过该值,则重启子进程。
警告
不得删除该变量,不得修改该变量的结构。
- settings.FLOW_ACK_TIMEOUT = 15¶
流程调用时等待调用结果的最大时间,单位是秒
- settings.LOGGING_CONFIG = {'formatters': {'normal': {'format': '%(asctime)s <%(processName)-10s,%(threadName)-10s> %(levelname)-8s %(name)s - %(message)s'}}, 'handlers': {'consoleErr': {'formatter': 'normal', 'level': 'ERROR', 'class': 'logging.StreamHandler', 'stream': 'ext://sys.stderr'}, 'file': {'backupCount': 1000, 'maxBytes': 10485760, 'formatter': 'normal', 'filename': '../logs/log', 'class': 'logging.handlers.RotatingFileHandler', 'level': 'DEBUG'}, 'fileErr': {'backupCount': 1000, 'maxBytes': 10485760, 'formatter': 'normal', 'filename': '../logs/err', 'class': 'logging.handlers.RotatingFileHandler', 'level': 'ERROR'}, 'console': {'formatter': 'normal', 'stream': 'ext://sys.stdout', 'class': 'logging.StreamHandler'}, 'smartbusFile': {'backupCount': 1000, 'maxBytes': 10485760, 'formatter': 'normal', 'filename': '../logs/smartbus', 'class': 'logging.handlers.RotatingFileHandler'}}, 'loggers': {'smartbus.ipcclient.client.Client': {'handlers': ['smartbusFile'], 'level': 'INFO'}, 'smartbus.netclient.client.Client': {'handlers': ['smartbusFile'], 'level': 'INFO'}}, 'version': 1, 'root': {'handlers': ['console', 'file', 'fileErr'], 'level': 'INFO'}}¶
日志设置
其格式请参考: https://docs.python.org/2/library/logging.config.html#configuration-dictionary-schema 与 https://docs.python.org/3/library/logging.config.html#configuration-dictionary-schema
- settings.SMARTBUS_CONFIG = {'type': 'net', 'initialize': {'unitid': 19}, 'clients': [{'authorUsr': None, 'slaverHost': None, 'masterPort': 8089, 'authorPwd': None, 'localClientType': 19, 'extInfo': None, 'slaverPort': 0, 'localClientId': 0, 'encoding': 'utf-8', 'masterHost': '10.4.62.45'}]}¶
SmartBus客户端配置
参数: - type –
smartbus客户端类型,有效值:"net" 或 "ipc"
- "net" : 使用smartbus网络通信客户端
- "ipc" : 使用smartbus进程通信客户端
- initialize –
smartbus客户端模块初始化参数属性字段
- 当 type 属性为 "net" 时,该属性必须设置一个属性 unitid
- 当 type 属性为 "ipc" 时,该属性必须设置两个属性 clientid 与 clienttype
具体含义请参考 smartbus 文档
- instance –
smartbus进程通信客户端地址参数属性字段
该 dict 属性需要设置3个属性:
- username
- password
- extInfo
具体含义请参考 smartbus 文档
注意
仅当 type 属性为 "ipc" 时有效
- clients –
smartbus网络通信客户端地址参数属性字段
该 list 属性的每个成员表示一个smartbus网络通信客户端,每个客户端的参数都是:
- localClientId
- localClientType
- masterHost
- masterPort
- slaverHost
- slaverPort
- authorUsr
- authorPwd
- extInfo
具体含义请参考 smartbus 文档
注意
仅当 type 属性为 "net" 时有效
- type –
- settings.SMARTBUS_NOTIFY_TTL = 10000¶
通过smartbus发送给IPSC流程的notify消息的生存期(ms)
- settings.WEBSERVER_LISTEN = (8080, '')¶
WEB 服务器监听端口与地址.
格式是:
(port, address)
警告
不得删除该变量,不得修改该变量的结构。