cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Set time out or Auto termination for long running query

NehaR
New Contributor III

Hi ,

We want to set auto termination for long running queries in data bricks adhoc cluster.

I attempted below two approaches in my notebook. Despite my understanding that queries should automatically terminate after one hour, with both the approaches queries exceeded this timeout limit and kept running

Approache 1:

SET spark.databricks.queryWatchdog.enabled=true;
SET spark.databricks.queryWatchdog.timeout=3600;
 
 
Approache 2:
SET STATEMENT_TIMEOUT = 3600;
 
Please suggest what wrong am i doing here?
 
 

 

3 REPLIES 3

JissMathew
New Contributor III

Hi @NehaR  

Apply these settings at the cluster-level configuration in the Databricks UI:

Go to the Cluster Settings.
Add the following Spark configuration:
spark.databricks.queryWatchdog.enabled true

spark.databricks.queryWatchdog.timeout 3600

Restart the cluster to apply the settings.

Hey @JissMathew,
I tried those configs on all-purpose clusters, but to no success. Is there any mention in docs that it is supposed to work? 
I know SET STATEMENT_TIMEOUT = 3600 should function only for Warehouses, but I'm looking for a solution that will affect normal clusters. 

JissMathew
New Contributor III

Hi @PiotrM  For normal all-purpose clusters, you would need an alternative approach to manage query timeouts, as the configuration for STATEMENT_TIMEOUT does not work directly.

Use spark.sql.broadcastTimeout or spark.sql.execution.timeout

spark.conf.set("spark.sql.broadcastTimeout", "3600")
spark.conf.set("spark.sql.execution.timeout", "3600000") 

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group