Secretary¤
secretary ¤
High level manager of all server connectors and bank of filters:
- load available connector modules,
- pass them the content of the relevant
settings.ini
section, - open and close the remote connections to servers by calling internal connector methods,
- process all filters of a given config subfolder in sequence by calling the internal
run_filters
method of each connector.
© 2022-2023 Aurélien Pierre
Classes¤
Secretary ¤
Bases: object
Backbone class managing the collection of available connectors. It is called from src/main.py
.
Load configuration from settings.ini
file in the current folder.
Load all connector modules from protocols
.
PARAMETER | DESCRIPTION |
---|---|
subfolder_path |
the current folder of filters
TYPE:
|
server_mode |
enable or disable the server mode, which makes processing slower to better share limited resources on a server.
TYPE:
|
number |
override the number of items to process defined in config file.
TYPE:
|
force |
ignore logs and reprocess items already processed.
TYPE:
|
ATTRIBUTE | DESCRIPTION |
---|---|
protocols |
connectors.Server): available [connectors.Server][] implementations for server protocols. They are exposed to user filters in
TYPE:
|
config_file |
object handling the
TYPE:
|
log_file |
object handling the main
TYPE:
|
Functions¤
load_connectors ¤
Iterate over all connectors for which we have both an implementation and credentials in the congig file. Initialize them and append them to the dictionnary [protocols][]
close_connectors ¤
Iterate over all initialized connectors and close the connections. Then close the logfile.
filters ¤
Process the loop over Content
objects from the implementation of [connectors.Server.run_filters][] for each filter.
PARAMETER | DESCRIPTION |
---|---|
filters |
iterable of available filters. See [utils.filter_bank][].
TYPE:
|
server_breathe ¤
If server mode is enabled, introduce a 0.5 s timeout to let other processes run. This is useful where heavy text parsing happens