Compare commits

..

5 commits

Author SHA1 Message Date
Alexis Métaireau
8532688bab
FIXUP: remove string tailcut, rename function 2025-01-14 14:31:00 +01:00
Alexis Métaireau
f6a616f23b
FIXUP: use proc_stderr when needed 2025-01-13 16:15:10 +01:00
Alexis Métaireau
3b961e6b90
FIXUP: Do not attach the stderr to the base object 2025-01-13 16:08:16 +01:00
Alexis Métaireau
3a56f51e94
FIXUP: join the thread before writing output 2025-01-13 15:54:30 +01:00
Alexis Métaireau
9705e92052
Add a --debug flag to the CLI to help retrieve more logs
When the flag is set, the `RUNSC_DEBUG=1` environment variable is added
to the outer container, and stderr is captured in a separate thread, before printing its output.
2025-01-13 15:07:40 +01:00

View file

@ -20,6 +20,9 @@ from ..util import get_tessdata_dir, replace_control_chars
log = logging.getLogger(__name__)
DOC_TO_PIXELS_LOG_START = "----- DOC TO PIXELS LOG START -----"
DOC_TO_PIXELS_LOG_END = "----- DOC TO PIXELS LOG END -----"
TIMEOUT_EXCEPTION = 15
TIMEOUT_GRACE = 15
TIMEOUT_FORCE = 5
@ -356,13 +359,14 @@ class IsolationProvider(ABC):
debug_bytes = stderr.getvalue()
debug_log = sanitize_debug_text(debug_bytes)
incomplete = "(incomplete) " if stderr_thread.is_alive() else ""
incomplete = "(incomplete)\n" if stderr_thread.is_alive() else ""
log.info(
"Conversion output (doc to pixels)\n"
f"----- DOC TO PIXELS LOG START {incomplete}-----\n"
f"{DOC_TO_PIXELS_LOG_START}\n"
f"{debug_log}" # no need for an extra newline here
"----- DOC TO PIXELS LOG END -----"
f"{incomplete}"
f"{DOC_TO_PIXELS_LOG_END}"
)
def start_stderr_thread(