◆ __init__()
def dc_processor.ProcessorStoreContentKVDB.ProcessorStoreContentKVDB.__init__ |
( |
|
self | ) |
|
Definition at line 54 of file ProcessorStoreContentKVDB.py.
56 foundation.CementApp.__init__(self)
57 self.exit_code = CONSTS.EXIT_SUCCESS
59 self.config_db_dir =
None 60 self.sqliteTimeout = SQLITE_TIMEOUT
61 self.input_data =
None 62 self.raw_contents_tbl =
None def __init__(self)
constructor
◆ getExitCode()
def dc_processor.ProcessorStoreContentKVDB.ProcessorStoreContentKVDB.getExitCode |
( |
|
self | ) |
|
◆ loadConfig()
def dc_processor.ProcessorStoreContentKVDB.ProcessorStoreContentKVDB.loadConfig |
( |
|
self | ) |
|
Definition at line 153 of file ProcessorStoreContentKVDB.py.
155 self.config = ConfigParser.ConfigParser()
156 self.config.optionxform = str
157 if self.pargs.config:
158 self.config.read(self.pargs.config)
159 except Exception
as err:
160 print MSG_ERROR_LOAD_CONFIG + err.message
◆ loadLogConfigFile()
def dc_processor.ProcessorStoreContentKVDB.ProcessorStoreContentKVDB.loadLogConfigFile |
( |
|
self | ) |
|
Definition at line 167 of file ProcessorStoreContentKVDB.py.
169 log_conf_file = self.config.get(
"Application",
"log")
170 logging.config.fileConfig(log_conf_file)
171 self.logger = Utils.MPLogger().
getLogger()
172 except Exception
as err:
173 print MSG_ERROR_LOAD_LOG_CONFIG_FILE + err.message
def loadLogConfigFile(self)
◆ loadOptions()
def dc_processor.ProcessorStoreContentKVDB.ProcessorStoreContentKVDB.loadOptions |
( |
|
self | ) |
|
Definition at line 180 of file ProcessorStoreContentKVDB.py.
182 self.config_db_dir = self.config.get(self.__class__.__name__,
"config_db_dir")
183 self.raw_contents_tbl = self.config.get(
"sqlite",
"raw_contents_tbl")
184 self.sqliteTimeout = self.config.getint(
"sqlite",
"timeout")
185 except Exception
as err:
186 print MSG_ERROR_LOAD_OPTIONS + err.message
◆ process()
def dc_processor.ProcessorStoreContentKVDB.ProcessorStoreContentKVDB.process |
( |
|
self | ) |
|
◆ processBatch()
def dc_processor.ProcessorStoreContentKVDB.ProcessorStoreContentKVDB.processBatch |
( |
|
self | ) |
|
Definition at line 134 of file ProcessorStoreContentKVDB.py.
137 input_pickled_object = sys.stdin.read()
138 stored_in_data = pickle.loads(input_pickled_object)
139 self.input_data = stored_in_data
146 except Exception
as err:
147 ExceptionLog.handler(self.logger, err, MSG_ERROR_PROCESS, (err))
148 self.exit_code = CONSTS.EXIT_FAILURE
◆ putContentToDB()
def dc_processor.ProcessorStoreContentKVDB.ProcessorStoreContentKVDB.putContentToDB |
( |
|
self | ) |
|
Definition at line 103 of file ProcessorStoreContentKVDB.py.
103 def putContentToDB(self):
105 if len(self.input_data.siteId):
106 db_name = self.config_db_dir +
"/" + self.input_data.siteId +
".db" 108 db_name = self.config_db_dir +
"/0.db" 109 self.logger.info(
"db_name: " + db_name)
113 connector = sqlite3.connect(db_name, timeout=self.sqliteTimeout)
114 connector.text_factory = str
116 cur = connector.cursor()
117 query =
"CREATE TABLE IF NOT EXISTS \ 118 %s(id VARCHAR(32) PRIMARY KEY UNIQUE, data TEXT, CDate DATETIME DEFAULT CURRENT_TIMESTAMP)" \
119 % (self.raw_contents_tbl)
121 cur.execute(
"INSERT OR REPLACE INTO raw_contents VALUES(?,?,datetime('now','localtime'))",
122 (self.input_data.urlId, self.input_data.raw_content))
124 except Exception
as err:
128 ExceptionLog.handler(self.logger, err,
'putContentToDB')
◆ run()
def dc_processor.ProcessorStoreContentKVDB.ProcessorStoreContentKVDB.run |
( |
|
self | ) |
|
◆ setup()
def dc_processor.ProcessorStoreContentKVDB.ProcessorStoreContentKVDB.setup |
( |
|
self | ) |
|
Definition at line 67 of file ProcessorStoreContentKVDB.py.
69 foundation.CementApp.setup(self)
70 self.args.add_argument(
'-c',
'--config', action=
'store', metavar=
'config_file', help=
'config ini-file')
◆ config
dc_processor.ProcessorStoreContentKVDB.ProcessorStoreContentKVDB.config |
◆ config_db_dir
dc_processor.ProcessorStoreContentKVDB.ProcessorStoreContentKVDB.config_db_dir |
◆ exit_code
dc_processor.ProcessorStoreContentKVDB.ProcessorStoreContentKVDB.exit_code |
◆ input_data
dc_processor.ProcessorStoreContentKVDB.ProcessorStoreContentKVDB.input_data |
◆ logger
dc_processor.ProcessorStoreContentKVDB.ProcessorStoreContentKVDB.logger |
◆ raw_contents_tbl
dc_processor.ProcessorStoreContentKVDB.ProcessorStoreContentKVDB.raw_contents_tbl |
◆ sqliteTimeout
dc_processor.ProcessorStoreContentKVDB.ProcessorStoreContentKVDB.sqliteTimeout |
The documentation for this class was generated from the following file: