From 1ba5aeefdcbff8254ed4461b429675a8847ed8c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Van=C4=8Dura?= Date: Wed, 5 Feb 2025 10:50:49 +0100 Subject: [PATCH] Actor: Documentation update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Václav Vančura --- .actor/README.md | 6 +++--- .actor/actor.sh | 9 ++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.actor/README.md b/.actor/README.md index a51c4d11..f45b55f3 100644 --- a/.actor/README.md +++ b/.actor/README.md @@ -49,7 +49,7 @@ This Actor wraps the [Docling project](https://ds4sd.github.io/docling/) to prov ### Using Apify API ```bash -curl --request POST \ +$ curl --request POST \ --url "https://api.apify.com/v2/acts/username~actorname/run" \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer YOUR_API_TOKEN' \ @@ -98,7 +98,7 @@ If the Actor logs warnings or debug info, these messages can be pushed to `DOCLI You can retrieve the results programmatically by calling: ```bash -apify key-value-store get OUTPUT_RESULT +$ apify key-value-stores get-value OUTPUT_RESULT ``` ### Example Outputs @@ -188,7 +188,7 @@ If you wish to develop or modify this Actor locally: 4. Run the Actor locally using: ```bash - apify run + $ apify run ``` ### Actor Structure diff --git a/.actor/actor.sh b/.actor/actor.sh index fe33a586..6faa34f5 100755 --- a/.actor/actor.sh +++ b/.actor/actor.sh @@ -2,14 +2,14 @@ # --- Setup Error Handling --- -# Initialize log file first +# Initialize log file first. LOG_FILE="/tmp/docling.log" touch "$LOG_FILE" || { echo "Fatal: Cannot create log file at $LOG_FILE" exit 1 } -# Ensure all output is logged +# Ensure all output is logged. exec 1> >(tee -a "$LOG_FILE") exec 2> >(tee -a "$LOG_FILE" >&2) @@ -67,7 +67,7 @@ if [ "$(echo "${INPUT}" | jq -r '.ocr')" = "true" ]; then DOC_CONVERT_CMD="${DOC_CONVERT_CMD} --ocr" fi -# Print the exact command that will be executed +# Print the exact command that will be executed. echo "Debug: Command string: $DOC_CONVERT_CMD" echo "Debug: Full command: /usr/bin/time -v bash -c \"$DOC_CONVERT_CMD\"" @@ -83,12 +83,11 @@ touch "$TIMESTAMP_FILE" || { exit 1 } -# Execute the command with timeout and memory monitoring echo "Starting document processing with memory monitoring..." /usr/bin/time -v bash -c "$DOC_CONVERT_CMD" 2>&1 | tee -a "$LOG_FILE" DOCLING_EXIT_CODE=${PIPESTATUS[0]} -# Check if the command failed and handle the error +# Check if the command failed and handle the error. if [ $DOCLING_EXIT_CODE -ne 0 ]; then echo "Error: Docling command failed with exit code $DOCLING_EXIT_CODE" echo "Memory usage information:"