[job] add 'init' option
This commit is contained in:
@@ -666,6 +666,28 @@ Note
|
||||
is *required*
|
||||
|
||||
|
||||
extractor.*.init
|
||||
----------------
|
||||
Type
|
||||
* ``bool``
|
||||
* ``string``
|
||||
Default
|
||||
``false``
|
||||
Description
|
||||
| Controls when to initialize extractor internals.
|
||||
| (
|
||||
`postprocessors <extractor.*.postprocessors_>`_,
|
||||
`archives <extractor.*.archive_>`_,
|
||||
`path-*` options, etc
|
||||
)
|
||||
|
||||
``true``
|
||||
Initialize everything immediately upon extractor start
|
||||
``false`` | ``"lazy"``
|
||||
Initialize data structures when processing the first ``post``
|
||||
or not at all when an extractor never yields a ``post``.
|
||||
|
||||
|
||||
extractor.*.input
|
||||
-----------------
|
||||
Type
|
||||
|
||||
@@ -85,6 +85,7 @@
|
||||
"sleep-429" : 60.0,
|
||||
|
||||
"actions": [],
|
||||
"init" : "lazy",
|
||||
"input" : null,
|
||||
"netrc" : false,
|
||||
"extension-map": {
|
||||
|
||||
@@ -274,6 +274,10 @@ class Job():
|
||||
self.pred_post = self._prepare_predicates("post", False)
|
||||
self.pred_queue = self._prepare_predicates("chapter", False)
|
||||
|
||||
init = self.extractor.config("init", False)
|
||||
if init and init != "lazy":
|
||||
self.initialize()
|
||||
|
||||
def _prepare_predicates(self, target, skip):
|
||||
predicates = []
|
||||
extr = self.extractor
|
||||
|
||||
Reference in New Issue
Block a user