Skip to main content

Wait Task

Waits for an ABBYY Cloud processing task to complete with automatic polling.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.

Inputs

  • Task - ABBYY task object to wait for completion (from Process Image, Process Document, etc.).

Options

  • Timeout - Maximum time to wait in seconds (default: 30). Set to 0 for no timeout.
  • Poll Time - Interval between status checks in seconds (default: 5).

Outputs

  • Task Status - Final status of the completed task including result URLs and processing details.

How It Works

The Wait Task node polls an ABBYY task until it completes or times out. When executed, the node:

  1. Decodes the input task object to extract task ID
  2. Immediately checks task status
  3. If completed or failed, returns immediately
  4. If still processing, waits for poll time interval
  5. Checks status again at each poll interval
  6. Continues until task completes, fails, or timeout is reached
  7. Returns final task status with results

Requirements

  • Valid ABBYY Cloud credentials
  • Valid task object from a previous ABBYY node
  • Adequate timeout for expected processing time

Error Handling

The node will return specific errors in the following cases:

  • Core.ABBYYCloud.GetTask - Cannot retrieve task object
  • Core.ABBYYCloud.Decode - Cannot decode task object
  • Core.ABBYYCloud.WaitTask - Error during task waiting
  • Core.ABBYYCloud.ErrTimeout - Task processing timeout exceeded
  • Core.ABBYYCloud.ErrRequest - API request failed during polling
  • Core.ABBYYCloud.Terminate - Wait task was terminated

Usage Example

Scenario: Process image and wait for results

1. Process Image node:
- Image Path: "C:/images/document.jpg"
- Language: English
- Export Format: txt
- Output: {{ $.task }}

2. Wait Task node:
- Task: {{ $.task }}
- Timeout: 60
- Poll Time: 5

3. Download results from {{ $.status.resultUrl }}

Scenario: Multi-page document with appropriate timeout

1. Process Image + Submit Image nodes (pages 1-10)

2. Process Document node:
- Task ID: {{ $.task.id }}
- Output: {{ $.task }}

3. Wait Task node:
- Task: {{ $.task }}
- Timeout: 300 (5 minutes for 10 pages)
- Poll Time: 10

4. Access results from status output

Polling Behavior

Initial Check (t=0s)

  • Checks status immediately upon execution
  • Returns immediately if already completed
  • No waiting if task is done

Polling Cycle

  • Waits for poll time interval
  • Checks task status
  • Repeats until completion or timeout

Example Timeline (timeout=30s, poll=5s)

  • t=0s: Check status (first check)
  • t=5s: Check status (poll #1)
  • t=10s: Check status (poll #2)
  • t=15s: Check status (poll #3)
  • t=20s: Check status (poll #4)
  • t=25s: Check status (poll #5)
  • t=30s: Check status (final check), then timeout if not done

Timeout Configuration

  • No Timeout (0): Wait indefinitely until completion
  • Short Timeout (15-30s): Small images, simple text
  • Medium Timeout (60-120s): Standard documents, few pages
  • Long Timeout (300-600s): Large documents, many pages, complex processing

Common Use Cases

  • Synchronous Processing - Wait for task completion before continuing workflow
  • Result Retrieval - Ensure results are ready before download
  • Sequential Workflows - Process multiple documents in sequence
  • Error Detection - Catch processing failures immediately
  • Simple Automation - Single-step OCR with automatic waiting

Tips and Best Practices

  • Timeout Setting:
    • Set based on expected processing time
    • Add buffer (2x expected time)
    • Small images: 30-60 seconds
    • Documents (1-5 pages): 60-120 seconds
    • Large documents (10+ pages): 300+ seconds
    • Complex processing: Add more time
  • Poll Time:
    • Default 5 seconds works for most cases
    • Reduce to 2-3s for fast processing
    • Increase to 10s for large documents
    • Balance between responsiveness and API calls
    • Respect API rate limits
  • Performance:
    • Polling adds no credit cost
    • More frequent polling = more API calls
    • Less frequent polling = longer wait for results
    • Find sweet spot for your use case
  • Error Handling:
    • Always handle timeout errors
    • Check task status in output for failure details
    • Enable Continue On Error for batch processing
    • Log timeout events for monitoring
  • Comparison with Get Task Status:
    • Wait Task: Automatic polling, simpler code
    • Get Task Status: Manual polling, more control
    • Use Wait Task for straightforward workflows
    • Use Get Task Status for complex conditional logic
  • Best Practices:
    • Always use Wait Task after Process nodes
    • Don't rely on task completing instantly
    • Set realistic timeouts
    • Monitor timeout frequency in production
    • Adjust timeout/poll time based on metrics
  • Workflow Patterns:
    • Simple: Process Image → Wait Task → Use Results
    • Multi-Page: Process Image → Submit Images → Process Document → Wait Task
    • Batch: Loop through images, each with Wait Task
    • Parallel: Process multiple tasks, wait for all
  • Production Considerations:
    • Set conservative timeouts in production
    • Implement retry logic for timeouts
    • Monitor average processing times
    • Alert on frequent timeouts
    • Log all task IDs for debugging
  • Resource Management:
    • Wait Task blocks workflow execution
    • Plan for blocked time in workflow design
    • Consider async patterns for high volume
    • Delete tasks after retrieving results