Schema:

ACCOUNT_USAGE

COMPLETE_TASK_GRAPHS view

You can use the Account Usage view to query the status of completed graph runs, such as runs that executed successfully, failed, or were cancelled. A graph is currently defined as a single scheduled task or a task graph composed of a scheduled root task and one or more child tasks. For the purposes of this function, root task refers to either the single scheduled task or the root task in a task graph.

The view avoids the 10,000 row limitation of the COMPLETE_TASK_GRAPHS.

Columns

Column NameData TypeDescription
ROOT_TASK_NAMETEXTName of the root task.
DATABASE_NAMETEXTName of the database that contains the graph.
SCHEMA_NAMETEXTName of the schema that contains the graph.
STATETEXT

State of the graph run:

  • SUCCEEDED: All tasks in the graph ran successfully to completion, or the root task run succeeded and one or more child task runs were skipped.
  • FAILED: One or more task runs in the graph failed, or the root task run succeeded and one or more child task runs failed.
  • CANCELLED: One or more task runs in the graph were cancelled, or the root task run succeeded and one or more child task runs were cancelled.

Note that if the state of the root task run is SKIPPED, the function does not return a row for the run.

SCHEDULED_FROMTEXT

One of:

  • SCHEDULE: The task was scheduled to run normally, as described in SCHEDULE or AFTER clauses of CREATE TASK.
  • EXECUTE_TASK: The task was scheduled to run with EXECUTE TASK.
  • MANUAL RETRY: The task was scheduled to run with EXECUTE TASK … RETRY LAST.
  • AUTOMATIC RETRY: The task was configured to retry on failure and the previous execution failed. For more information, see Automatically retry failed task runs.
  • TRIGGER : The task was run because the stream, in the WHEN clause of the task, contained new data.

For runs of child tasks in a task graph, the column returns the same value as the root task run.

FIRST_ERROR_TASK_NAMETEXTName of the first task in the graph that returned an error; returns NULL if no task produced an error.
FIRST_ERROR_CODENUMBERError code of the error returned by the task named in FIRST_ERROR_TASK_NAME; returns NULL if no task produced an error.
FIRST_ERROR_MESSAGETEXTError message of the error returned by the task named in FIRST_ERROR_TASK_NAME; returns NULL if no task produced an error.
SCHEDULED_TIMETIMESTAMP_LTZTime when the root task was scheduled to start running. Note that we make a best effort to ensure absolute precision, but only guarantee that tasks do not execute before the scheduled time.
QUERY_START_TIMETIMESTAMP_LTZTime when the query in the root task definition started to run. This timestamp aligns with the start time for the query returned by QUERY_HISTORY.
NEXT_SCHEDULED_TIMETIMESTAMP_LTZTime when the standalone or root task (in a DAG of tasks) is next scheduled to start running, assuming the current run of the standalone task or DAG started at the SCHEDULED_TIME time completes in time.
COMPLETED_TIMETIMESTAMP_LTZTime when the last task in the DAG was completed.
ROOT_TASK_IDTEXTUnique identifier for the root task in a DAG. This ID matches the ID column value in the SHOW TASKS output for the same task.
GRAPH_VERSIONNUMBERInteger identifying the version of the DAG that was run, or is scheduled to be run.
RUN_IDNUMBERTime when the standalone or root task in a DAG is/was originally scheduled to start running. Format is epoch time (in milliseconds).

Original scheduled time refers to rare instances when the system may reschedule the same task to run at a different time to retry it or rebalance the load. If that happens, RUN_ID shows the original scheduled run time and SCHEDULED_TIME shows the rescheduled run time.

Note that RUN_ID may not be a unique identifier for the current task/graph run prior to retry. You may use GRAPH_RUN_GROUP_ID column as a replacement for RUN_ID.
ATTEMPT_NUMBERNUMBER

Integer representing the number of attempts to run this task. Initially one.

CONFIGTEXTDisplays the graph level configuration used during the graph run if explicitly set. Otherwise displays NULL.
GRAPH_RUN_GROUP_IDTEXTIdentifier for the graph run. When a graph run has multiple task runs, each task run will show the same GRAPH_RUN_GROUP_ID. The combination of GRAPH_RUN_GROUP_ID, and ATTEMPT_NUMBER can be used to uniquely identify a graph run.
BACKFILL_INFOOBJECTReserved for future use. The returned value for all rows is NULL.

Usage notes

  • Latency for the view may be up to 45 minutes.
  • The view only displays objects for which the current role for the session has been granted access privileges.

Examples

Retrieve records for the 10 most recent task graph runs completed in your account:

select root_task_name, state from snowflake.account_usage.complete_task_graphs
  limit 10;