> For the complete documentation index, see [llms.txt](https://docs.snowkill.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.snowkill.net/reference/engine.md).

# Engine

Engine object `SnowKillEngine` accepts Snowflake connection, performs REST API calls and checks conditions.

***

## \_\_init\_\_()

Arguments:

* **connection** (SnowflakeConnection)
* **max\_workers** (int) - number of thread workers, which are primarily used to read query plans in parallel (default: 8)

***

## check\_and\_kill\_pending\_queries()

Accept list of conditions, get information about running, blocked and queued queries, perform checks, kill queries, return matching queries.

Arguments:

* **conditions** (List\[AbstractQueryCondition])

Returns:&#x20;

* List\[[CheckResult](/reference/check-result.md)]

***

## **get\_pending\_queries()**

Get information about running, blocked and queued queries. Return merged dict of queries. Useful for debugging and for creating your own custom automation.

Arguments:

* **blocked** (bool) - add `BLOCKED` queries to result
* **queued** (bool) - add `QUEUED` queries to result
* **running** (bool) - add `RUNNING` queries to result

Returns:

* Dict\[str, [Query](/reference/query.md)] - key is query\_id

***

## get\_query\_by\_id()

Get information about one specific query (in any status). If query was not found, returns `None`. It is very useful for debugging and development of new conditions and formatters.

* **query\_id** (str) - UUID of query

Returns:

* Optional\[[Query](/reference/query.md)]

***

get\_query\_plan()

Get information about one specific query plan. Query can be in any status. If plan is not available, raises an exception.

* **query\_id** (str) - UUID of query

Returns:

* [QueryPlan](/reference/query-plan.md)

***

## get\_holding\_locks()

Get information about all queries blocked by holding locks on account.

Returns:

* Dict\[str, [HoldingLock](/reference/holding-lock.md)] - key is query\_id
