core
core copied to clipboard
Support specific --log-level overrides in `ocrd process` tasks
When calling ocrd process with -l DEBUG as parameter to a single process, this gives e.g.
/usr/bin/time -o /home/ocrd/workspace/gue-11660-24-e-1/time docker run --rm -u 1010 -e TESSDATA_PREFIX=/models -v /home/ocrd/workspace/gue-11660-24-e-1:/data -v
~/models:/models -w /data -- ocrd/all:maximum ocrd process 'olena-binarize -I OCR-D-IMG -O OCR-D-BIN' \ 'cis-ocropy-deskew -I OCR-D-BIN -O OCR-D-DESKEW' \ 'any
baseocr-crop -I OCR-D-DESKEW -O OCR-D-CROP' \ 'cis-ocropy-segment -I OCR-D-CROP -O OCR-D-PAGE-SEG -l DEBUG -P level-of-operation page' \ 'tesserocr-recognize -I
OCR-D-PAGE-SEG -O OCR-D-OCR -P model Fraktur'
Traceback (most recent call last):
File "/usr/bin/ocrd", line 33, in <module>
sys.exit(load_entry_point('ocrd', 'console_scripts', 'ocrd')())
File "/usr/lib/python3.6/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/usr/lib/python3.6/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/usr/lib/python3.6/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/lib/python3.6/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/build/core/ocrd/ocrd/cli/process.py", line 28, in process_cli
run_tasks(mets, log_level, page_id, tasks, overwrite)
File "/build/core/ocrd/ocrd/task_sequence.py", line 124, in run_tasks
tasks = [ProcessorTask.parse(task_str) for task_str in task_strs]
File "/build/core/ocrd/ocrd/task_sequence.py", line 124, in <listcomp>
tasks = [ProcessorTask.parse(task_str) for task_str in task_strs]
File "/build/core/ocrd/ocrd/task_sequence.py", line 38, in parse
raise Exception("Failed parsing task description '%s' with tokens remaining: '%s'" % (argstr, tokens))
Exception: Failed parsing task description ' cis-ocropy-segment -I OCR-D-CROP -O OCR-D-PAGE-SEG -l DEBUG -P level-of-operation page' with tokens remaining: '['-
l', 'DEBUG', '-P', 'level-of-operation', 'page']'
--log-level/-l is not currently supported on task level, only globally as an option to ocrd process.
I will correct this, once the other logging refactoring PR is finished.
Note: I have renamed the issue so it does not get confused with the (planned) --debug parameter.
BTW I don't think any of this will help you unless #592 gets fixed.