rocuinneagain
Forum Replies Created
-
This conversation could help:
-
rocuinneagain
MemberOctober 12, 2022 at 12:00 am in reply to: can we able to do exception handling in kdb+/q -
rocuinneagain
MemberOctober 12, 2022 at 12:00 am in reply to: can we able to do exception handling in kdb+/qThe
q
language is documented with lots of learning materials on: https://code.kx.com/q/There are also courses on https://kx.com/academy/
k
is the underlying language which you do not need to interact with. See this note: https://community.kx.com/t5/New-kdb-q-users-question-forum/rotate-function-differences-between-k-and-q/m-p/13186/highlight/true#M544 -
rocuinneagain
MemberOctober 11, 2022 at 12:00 am in reply to: saving a variable to the server using the clientq)h:hopen `::5678 q)h({set;`myVariable;1 2 3 4 5) /or q)h({x::y};`myVariable;1 2 3 4 5)
-
Only symbols. You can view their memory usage in
.Q.w[]
- syms: number of interned symbols
- symw: bytes used by interned symbols
-
lsof
andnetstat
can give you information about the open handles even if you cannot connect yourself -
There are some notes on late data in this blog post: https://kx.com/blog/partitioning-data-in-kdb/
It outlines the basics of using lookup tables per partition.
Another option involves taking copies of HDB partitions and upserting the late data to the copy.
Then this new partition with extra data replaces the old one. Coordination is needed to ensure any HDB process reading the data does not error during this process.
-
https://code.kx.com/q/basics/errors/#:~:text=conn,connections%20(1022%20max)
The conn error happens when the limit of 1022 open connections is hit.
Some process(es) must be continuously opening handles but not closing them after use.
You can count .z.W at any time to see how many open handles there are.
-38! can give you information on the type of each open handle.
At any time you can force close handles using hclose.
To trace the source of the problem you can add logging and monitoring to the port open and close call-backs, .z.po and .z.pc.
One example is the dotz library which you can customise to your needs.
-
rocuinneagain
MemberSeptember 26, 2022 at 12:00 am in reply to: Possible memory leak with enumerated table dump?I tested this in 3.6 2019.04.02 could reproduce it.
The issue is not present in 3.6 2020.05.04.
Release notes of fix:
2019.05.24 FIX reading enums in log format could leak memory. e.g.
q)h:hopen`:a set (); h enlist(`u;`sym?`a`b`c); hclose h; do[5;get`:a;0N!.Q.w[]`used]
-
rocuinneagain
MemberSeptember 26, 2022 at 12:00 am in reply to: How to plot contents from dynamic queryRegular Expressions can be used to define axes instead of a data source column:
https://code.kx.com/dashboards/canvascharts/#regex-for-data
-
-
rocuinneagain
MemberSeptember 14, 2022 at 12:00 am in reply to: verify taskSet of a running kdb+ processYou can run:
q)system”taskset -pc “,string .z.i
“pid 73’s current affinity list: 0-7”
-
A timespan can be used directly
q)select avg col by 0D00:00:00.005 xbar time from t time | col -----------------------------| ---- 2022.09.09D07:40:23.110000000| 3 2022.09.09D07:40:23.115000000| 11.5 2022.09.09D07:40:23.120000000| 18
-
rocuinneagain
MemberSeptember 6, 2022 at 12:00 am in reply to: Why a curl command works but a similar .Q.hp command fails when sending alerts to TEAMS from KDBYou can use a second q process help you to debug.
Set a Listening-port p and have the HTTP Post handler (.z.pp) print incoming message contents
p 5000 .z.pp:{show x;x}
Trying curl from command line
$ curl -H ‘Content-type: application/json’ -d ‘{“text”:”Hello World”}’ localhost:5000
The server q process prints:
” {“text”:”Hello World”}” `Host`User-Agent`Accept`Content-type`Content-Length!(“localhost:5000″;”curl/7.58.0″;”*/*”;”application/json”;”22″)
From a client q process using .Q.hp
q).Q.hp[“http://localhost:5000″;.h.ty`json] .j.j enlist[`text]!enlist”Hello World”
The server q process prints:
” {“text”:”Hello World”}” `Accept-Encoding`Connection`Host`Content-type`Content-length!(“gzip”;”close”;”localhost:5000″;”application/json”;”22″)
There are only slight differences in the headers.
You may need to consult documentation of the server you are connecting to to confirm if it has specific header requirements.
(Clients using KX Insights have access to kurl with more options than .Q.hp)
-
rocuinneagain
MemberSeptember 6, 2022 at 12:00 am in reply to: Accumulators – Access additional list / columnYes in that case an accumulator is needed. One method you could choose would be to pass a table through to accumulate while also allowing you to look back to previous rows:
q)update c2:1_@[;`c2]{y[`c2]:enlist $[(y[`c1][0]>last x[`c2]) or ((last x[`c])<last x[`c2]);y[`c1][0];last x`c2];x,y}/[enlist each {(1#0#x),x}update c2:0 from `c`c1#t] from t c c1 c2 ---------- 30 10 10 40 20 20 25 5 20 20 25 25 4 5 5 4 4 4 4.5 3 4 4.5 3.5 4