How to find which warehouse a Snowflake Task is running against?

Viewed 440

I can see the history of my task using:

select *
  from table(information_schema.task_history())
  where NAME = 'MY_TASK'
  order by scheduled_time;

But this specific task failed because of:

Statement reached its statement or warehouse timeout of 3,600 second(s) and was canceled.

So I issued the following command to increase the timeout of the warehouse I think it's running against:

ALTER WAREHOUSE "MY_WAREHOUSE" SET STATEMENT_TIMEOUT_IN_SECONDS = 18000

But the task still gets the same error. How can I conclusively identify the warehouse I need to issue this command?

2 Answers

If you want your task to use a specific warehouse, you can define it when creating the task using the WAREHOUSE parameter, otherwise it will be serverless task and you can only define the USER_TASK_MANAGED_INITIAL_WAREHOUSE_SIZE parameter.

If you have problems with TIMEOUT on task, change the default value of the USER_TASK_TIMEOUT_MS parameter, by default it is 3600 seconds.

If you already have a task, you can change this parameter using the ALTER command, for example change to 4 hours:

ALTER TASK IF EXISTS mytask
SET USER_TASK_TIMEOUT_MS = 14400000;

Reference: CREATE TASK, ALTER TASK

Remember that the task_history () function is very limited, by default it only returns 100 rows and only stores data for 7 days. It's much better to use the TASK_HISTORY view.

Reference: task_history () function, TASK_HISTORY view

Related