Mahesh Chavan
Mahesh Chavan

Reputation: 3

Timeout in kdb+ for function

I have a function dummyFun:{[x;y] show x+y} in kdb+.

but after calling it takes too much time to execute. I want to apply timeout for this function execution. Like if it doesn't return anything it should throw an error timeout

Upvotes: 0

Views: 602

Answers (1)

Matt Moore
Matt Moore

Reputation: 2800

You can set client query timeouts with -T x / system"T x"

https://code.kx.com/q/basics/cmdline/#-t-timeout

If you want to timeout your own function within the q console you can use the 0 handle when calling your code/function:

// eg
\T 1
0"system\"sleep 2\"
'stop

// with (func;params)
0 (dummyFun;x;y)

Upvotes: 3

Related Questions