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 = {'handlers': {'smartbusFile': {'formatter': 'normal', 'maxBytes': 10485760, 'class': 'logging.handlers.RotatingFileHandler', 'filename': '../logs/smartbus', 'backupCount': 1000}, 'consoleErr': {'formatter': 'normal', 'level': 'ERROR', 'class': 'logging.StreamHandler', 'stream': 'ext://sys.stderr'}, 'file': {'formatter': 'normal', 'level': 'DEBUG', 'filename': '../logs/log', 'maxBytes': 10485760, 'class': 'logging.handlers.RotatingFileHandler', 'backupCount': 1000}, 'console': {'formatter': 'normal', 'class': 'logging.StreamHandler', 'stream': 'ext://sys.stdout'}, 'fileErr': {'formatter': 'normal', 'level': 'ERROR', 'filename': '../logs/err', 'maxBytes': 10485760, 'class': 'logging.handlers.RotatingFileHandler', 'backupCount': 1000}}, 'formatters': {'normal': {'format': '%(asctime)s <%(processName)-10s,%(threadName)-10s> %(levelname)-8s %(name)s - %(message)s'}}, 'root': {'level': 'DEBUG', 'handlers': ['console', 'file', 'fileErr']}, 'loggers': {'smartbus.netclient.client.Client': {'level': 'INFO', 'handlers': ['smartbusFile']}, 'smartbus.ipcclient.client.Client': {'level': 'INFO', 'handlers': ['smartbusFile']}}, 'version': 1}

日志设置

其格式请参考: https://docs.python.org/2/library/logging.config.html#configuration-dictionary-schemahttps://docs.python.org/3/library/logging.config.html#configuration-dictionary-schema

settings.SMARTBUS_CONFIG = {'clients': [{'encoding': 'utf-8', 'masterPort': 8089, 'masterHost': '192.168.88.30', 'localClientType': 18, 'localClientId': 0, 'slaverHost': None, 'authorPwd': None, 'authorUsr': None, 'extInfo': None, 'slaverPort': 0}], 'initialize': {'unitid': 19}, 'type': 'net'}

SmartBus客户端配置

参数:
  • type

    smartbus客户端类型,有效值:"net""ipc"

    • "net" : 使用smartbus网络通信客户端
    • "ipc" : 使用smartbus进程通信客户端
  • initialize

    smartbus客户端模块初始化参数属性字段

    • type 属性为 "net" 时,该属性必须设置一个属性 unitid
    • type 属性为 "ipc" 时,该属性必须设置两个属性 clientidclienttype

    具体含义请参考 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" 时有效

settings.SMARTBUS_NOTIFY_TTL = 10

通过smartbus发送给IPSC流程的notify消息的生存期(秒),应该是大于0的整数或者浮点数。

警告

该变量不得删除

settings.WEBSERVER_LISTEN = (8888, '')

WEB 服务器监听端口与地址.

格式是:

(port, address)

警告

不得删除该变量,不得修改该变量的结构。