| author: | Liu.Jia Guannan Ma |
|---|---|
| create_date: | 2014 |
| last_date: | 2014 |
| descrition: | Complex conf support |
Bases: cup.err.BaseCupException
数组类型错误
Bases: object
Depreciated class. Please do not use it. Use python configparser instead.
Bases: object
历史遗留类. 请忽略. 操作我厂configure公共库conf的类。 主要调用cfmod这个工具进行. 推荐使用Configure2Dict转换成dict,在使用Dict2Configure类来操作conf文件. 如果只是简单的更新某个key, 可以使用此类.
Bases: dict
ConfDict that Configure2Dict and Dict2Configure can use.
Bases: cup.err.BaseCupException
ConfDict Error
Bases: list
增加一个conf的数组属性. 以ConfList的数据方式表现
e.g.
@disk: /home/disk1 @disk: /home/disk2
Bases: cup.err.BaseCupException
ConfList Error
Bases: object
Configure2Dict support conf features below:
As we support access/modify comments in a conf file, you should obey rules below:
Comment closely above the object you want to comment. Do NOT comment after the line.
Otherwise, you might get/set a wrong comment above the object.
sections
2.1 global section
- if key:value is not under any [section], it is under the global layer
by default
global section is the 0th layer section
e.g. test.conf:
# test.conf global-key: value global-key1: value1
1st layer section
above. It’s the 2nd layer section.
above. And the prefix .. means it is the 3rd layer section
e.g.: test.conf:
global-key: value [section]
host: abc.com port: 8080 [.section_child]
child_key: child_value [..section_child_child]
control: ssh [...section_child_child_child]
wow_key: wow_value
get_dict method will convert conf into a ConfDict which is derived
from python dict.
Access the section with confdict[‘section’][‘section-child’].
comments)
key:value can be set under Global section which is closely after the 1st line with no [section] above.
key:value can also be set under sections.
# test.conf key1: value1 [section]
key_section: value_in_section [.seciton]
key_section_child: value_section_child
key:value arrays can be access with confdict[‘section’][‘disk’].
You will get a ConfList derived from python list.
# test.conf # Global layer, key:value host: abc.com port: 12345 # 1st layer [monitor] @disk: /home/data0 @disk: /home/data1 [section]
@disk: /home/disk/disk1 @disk: /home/disk/disk2
# test.conf # Global layer, key:value host: abc.com port: 12345 # 1st layer [monitor] @disk: /home/data0 @disk: /home/data1 [section]
@disk: /home/disk/disk1 @disk: /home/disk/disk2
timeout: 100 regex: sshd # 2nd layer that belongs to [monitor] [.timeout]
# key:value in timeout max: 100 # 3rd layer that belongs to [monitor] [timeout] [..handler]
default: exit
Bases: object
Convert Dict into Configure. You can convert a ConfDict or python dict into a conf file.
Bases: cup.err.BaseCupException
Key error class
Bases: cup.err.BaseCupException
Line error class
Bases: cup.err.BaseCupException
unkown error class
Bases: cup.err.BaseCupException
value error class
| descrition: | heartbeat related module test-case-name: twisted.python.test.test_constants Copyright (c) Twisted Matrix Laboratories. See LICENSE for details. |
|---|---|
| license: | CUP dev team modified and redistrbuted this module, according to MIT license(http://opensource.org/licenses/mit-license.php) that Twisted lib obeys. If any concern, plz contact mythmgn@gmail.com. |
Bases: cup.util.constants._Constant
L{NamedConstant} defines an attribute to be a named constant within a collection defined by a L{Names} subclass.
L{NamedConstant} is only for use in the definition of L{Names} subclasses. Do not instantiate L{NamedConstant} elsewhere and do not subclass it.
Bases: cup.util.constants._Constant
L{ValueConstant} defines an attribute to be a named constant within a collection defined by a L{Values} subclass.
L{ValueConstant} is only for use in the definition of L{Values} subclasses. Do not instantiate L{ValueConstant} elsewhere and do not subclass it.
Bases: cup.util.constants._Constant
L{FlagConstant} defines an attribute to be a flag constant within a collection defined by a L{Flags} subclass.
L{FlagConstant} is only for use in the definition of L{Flags} subclasses. Do not instantiate L{FlagConstant} elsewhere and do not subclass it.
Bases: cup.util.constants._ConstantsContainer
A L{Names} subclass contains constants which differ only in their names and identities.
Bases: cup.util.constants._ConstantsContainer
A L{Values} subclass contains constants which are associated with arbitrary values.
Retrieve a constant by its value or raise a C{ValueError} if there is no constant associated with that value.
@param value: The value of one of the constants defined by C{cls}.
@return: The L{ValueConstant} associated with C{value}.
Bases: cup.util.constants.Values
A L{Flags} subclass contains constants which can be combined using the common bitwise operators (C{|}, C{&}, etc) similar to a I{bitvector} from a language like C.
| author: | Guannan Ma |
|---|---|
| create_date: | 2014 |
| last_date: | 2014 |
| descrition: | context for threadpool |
| author: | Guannan Ma |
|---|---|
| create_date: | 2014 |
| last_date: | 2014 |
用来生成各类唯一数,字符集,线程安全的自增uint的类。 目前生成函数较少, 欢迎大家贡献ci. Singleton类。初始化需要传入一个用来生成字符集的string.
| 初始化函数: |
|
|---|---|
| 成员函数: |
|
| author: | Guannan Ma |
|---|---|
| create_date: | 2014 |
| last_date: | 2014 |
| descrition: | misc functions |
| author: | Zhaominghao Guannan Ma |
|---|---|
| create_date: | 2014 |
| last_date: | 2014 |
| descrition: | cup thread module |
Bases: threading.Thread
CupThread继承threading.Thread, 支持threading.Thread所有功能和特性, CupThread扩展了三个功能,raise_exc给线程发送raise信号,get_my_tid返回线程id, terminate同步中止线程
| author: | Guannan Ma |
|---|---|
| create_date: | 2014 |
| last_date: | 2014 |
| descrition: | Guannan ported threadpool from twisted.python. Mit License applied for twisted. http://www.opensource.org/licenses/mit-license.php if any concern, plz contact mythmgn@gmail.com |
Bases: object
Threadpool class
| Parameters: |
|
|---|
| Parameters: |
|
|---|
回返当前threadpool的状态信息. 其中queue_len为当前threadpool排队的作业长度 waiters_num为当前空闲的thread num working_num为当前正在工作的thread num thread_num为当前一共可以使用的thread num:
stat = {}
stat['queue_len'] = self._jobqueue.qsize()
stat['waiters_num'] = len(self._waiters)
stat['working_num'] = len(self._working)
stat['thread_num'] = len(self._threads)