core.secretary¤
core.secretary
¤
High level manager of all server connectors and bank of filters:
- load available connector modules,
- pass them the content of the relevant
settings.inisection, - 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_filtersmethod of each connector.
© 2022-2023 Aurélien Pierre
Classes¤
core.secretary.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 core.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¤
core.secretary.Secretary.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
core.secretary.Secretary.close_connectors
¤
Iterate over all initialized connectors and close the connections. Then close the logfile.
core.secretary.Secretary.filters
¤
filters(filters: utils.filter_bank)
Process the loop over Content objects from the implementation of core.connectors.Server.run_filters for each filter.
| PARAMETER | DESCRIPTION |
|---|---|
filters
|
iterable of available filters. See core.utils.filter_bank.
TYPE:
|
core.secretary.Secretary.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