Module 11 · Lesson 14 of 15Detailed study · about 25 min

Monitor failures, timeouts and retries without duplicating work

Use task history and business state together. A failed or skipped task needs a different response from a successful run whose business result is wrong.

Understand the idea

Start with STATE and ERROR_MESSAGE, then follow QUERY_ID to query details. Check role/warehouse grants for authorization failures, SQL and input contracts for processing failures, and query profile or waits for timeouts. Increasing the timeout blindly can hide a blocked or inefficient pipeline.

Key ideas in simple English
ConceptWhat it means
TASK_HISTORYExecution state, query ID and error evidence.
TimeoutA run limit, not a data-quality validation.
RetryMay restart a failed graph step rather than repeat every successful predecessor.
SuspensionStops future scheduling until deliberately resumed.

A concrete example

Match the root, child and finalizer execution records. A scheduled row without completion is not a successful run.

Remember: Change controls based on the failure cause, then verify the committed business state.

Explain it step by step · full theory

Understand the concept

Start with STATE and ERROR_MESSAGE, then follow QUERY_ID to query details. Check role/warehouse grants for authorization failures, SQL and input contracts for processing failures, and query profile or waits for timeouts. Increasing the timeout blindly can hide a blocked or inefficient pipeline.

TASK_AUTO_RETRY_ATTEMPTS on the root controls graph retry attempts under supported rules. EXECUTE TASK ... RETRY LAST retries an eligible failed graph from its failure point. It is not a command to repair stale streams or bad source contracts.

Walk through the behavior

A retried logging task may append duplicate log entries if it already committed work before failure. Production audit design needs a stable run identity or idempotent writes. Our demonstration log is intentionally only an observation tool.

Do not promise that SUSPEND cancels an in-flight run. Inspect active execution and use documented cancellation procedures when needed, then reconcile transaction outcomes before restarting.

Words used in this lesson
TASK_HISTORY
Execution state, query ID and error evidence.
Timeout
A run limit, not a data-quality validation.
Retry
May restart a failed graph step rather than repeat every successful predecessor.
Suspension
Stops future scheduling until deliberately resumed.

See how it works

Choose a step to explore the idea at your own pace.

Open the interactive explanation
Interactive explainer1 / 3

Monitor failures, timeouts and retries without duplicating work

Source data
Change boundary

Start with the source

Use task history and business state together. A failed or skipped task needs a different response from a successful run whose business result is wrong.

Automatic playback is off for reduced motion. Select any step or use Previous and Next. Illustrations explain behavior; they are not live measurements.

Read the complete diagram explanation
  1. Start with the source

    Use task history and business state together. A failed or skipped task needs a different response from a successful run whose business result is wrong.

  2. Follow the work

    Start with STATE and ERROR_MESSAGE, then follow QUERY_ID to query details. Check role/warehouse grants for authorization failures, SQL and input contracts for processing failures, and query profile or waits for timeouts. Increasing the timeout blindly can hide a blocked or inefficient pipeline.

  3. Explain the outcome

    Change controls based on the failure cause, then verify the committed business state.

Try the SQL or command

Read → predict → run in your learning environment → compare. You can also learn by reading without an account.

New to SQL? Where to run it and how to read it

A query is a question written in SQL. Snowflake runs it and returns a result table. This website shows examples; it does not connect to your account.

  1. No account yet? Read and predict the output first. Follow the account and Snowsight lesson when you are ready.
  2. For SQL practice, use a learning account in Snowsight and select an authorized role and warehouse. A role determines permissions; a warehouse supplies processing power. Follow the example’s database/schema setup when it refers to stored objects.
  3. Read the entire example, including comments beginning with --. Run the selected statement or labeled block in the stated order. Examples labeled Python, shell or HTTP belong in that client, not in a SQL editor.
  4. Compare values and row counts with the explained result. If an example deliberately causes an error, follow its rollback and cleanup steps before continuing.
SELECT / FROM
Choose the values to return / identify their input.
VALUES / COLUMN1
VALUES supplies tiny example rows. COLUMN1 means their first column, COLUMN2 their second.
AS / WITH
AS gives a result a readable name. WITH names a temporary query step within one statement.
NULL / ::
NULL means missing or unknown. The :: notation converts a value to a named data type.
Session
One connection and its settings. Keep related transaction steps in the same session.
Database.schema.table
A full address for stored data. It is separate from the warehouse that processes queries.

Need the L2_OBJECTS_LAB setup? Open the first database-object lesson →

Help with common practice errors
  • No active warehouse: select a warehouse your role can use. Do not assume you need to create a new one.
  • Object missing or not authorized: check the full name, required setup and active role. Ask the account owner for access if needed.
  • Object already exists: setup may already have run. Read the current state or choose a fresh lab name consistently; do not add OR REPLACE blindly.
  • Different result: check whether an earlier INSERT or UPDATE changed the data. VALUES examples provide their own fresh input for each statement.

Before running this lesson

Manual learning lab; nothing runs on this website. Complete lesson 1 setup in L2_OBJECTS_LAB.M11_LAB and follow the lesson order. Use the same authorized role and warehouse for manual SQL. Task templates use <lab_warehouse>: replace it with an approved warehouse name. Do not activate several consumers against the same stream. Each task starts suspended; running or resuming it can consume compute credits.

Inspect all graph steps

SQL · example
SELECT NAME,STATE,QUERY_ID,ERROR_CODE,ERROR_MESSAGE,SCHEDULED_TIME,COMPLETED_TIME
FROM TABLE(L2_OBJECTS_LAB.INFORMATION_SCHEMA.TASK_HISTORY(RESULT_LIMIT=>100))
WHERE SCHEMA_NAME='M11_LAB' ORDER BY SCHEDULED_TIME DESC;
SHOW TASKS IN SCHEMA L2_OBJECTS_LAB.M11_LAB;
SELECT * FROM TASK_RUN_LOG ORDER BY RAN_AT;

What to expect and why

Match the root, child and finalizer execution records. A scheduled row without completion is not a successful run.

Retry template after diagnosing an eligible failed graph

SQL · example
-- Only after diagnosing a failed PIPELINE_ROOT graph and its retry eligibility:
-- EXECUTE TASK PIPELINE_ROOT RETRY LAST;
ALTER TASK PIPELINE_ROOT SUSPEND;
ALTER TASK PIPELINE_OBSERVE SUSPEND;
ALTER TASK PIPELINE_FINISH SUSPEND;

What to expect and why

Do not retry a graph with no eligible failed run. These suspension commands are appropriate after the manual graph exercise; inspect ongoing executions separately.

Check your understanding

Choose an answer, then check your reasoning. This is practice, not a scored test.

What should happen before raising a task timeout?

Try it yourself

Why might repeating a child step duplicate a log row?

Compare your reasoning

Its earlier attempt could have committed an INSERT before failing elsewhere. Use run-aware idempotent audit writes in a production design.

Official sources and curriculum

Module 11 · See module scope