From 8ca258bbcb57d842f24b0bdaafba95c41e993e34 Mon Sep 17 00:00:00 2001 From: koconnor99-aq Date: Thu, 21 Mar 2024 16:20:46 +0000 Subject: [PATCH 1/8] Adding timezone functionality to the reporter function --- code/processes/reporter.q | 13 ++++++++----- config/filealerterprocessed/.d | Bin 0 -> 34 bytes config/filealerterprocessed/filename | Bin 0 -> 4112 bytes config/filealerterprocessed/filename# | Bin 0 -> 4238 bytes config/filealerterprocessed/filesize | Bin 0 -> 32 bytes config/filealerterprocessed/md5hash | Bin 0 -> 4112 bytes config/filealerterprocessed/md5hash# | Bin 0 -> 4164 bytes config/reporter.csv | 2 +- 8 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 config/filealerterprocessed/.d create mode 100644 config/filealerterprocessed/filename create mode 100644 config/filealerterprocessed/filename# create mode 100644 config/filealerterprocessed/filesize create mode 100644 config/filealerterprocessed/md5hash create mode 100644 config/filealerterprocessed/md5hash# diff --git a/code/processes/reporter.q b/code/processes/reporter.q index 9b733880e..3725af112 100644 --- a/code/processes/reporter.q +++ b/code/processes/reporter.q @@ -9,7 +9,7 @@ queryid:`long$0; / - initial query id value inputcsv:string inputcsv /- stores report information -reports:([] name:`$(); query:(); resulthandler:(); gateway:(); joinfunction:(); proctype:(); procname:(); start:`minute$(); end:`minute$(); period:`minute$(); timeoutinterval:`timespan$(); daysofweek:()); +reports:([] name:`$(); query:(); resulthandler:(); gateway:(); joinfunction:(); proctype:(); procname:(); start:`minute$(); end:`minute$(); period:`minute$(); timeoutinterval:`timespan$(); daysofweek:(); timezone:`$()); /- status of current queries querystatus:([queryid:`u#`long$()] name:`symbol$(); time:`timestamp$(); servertype:(); timeout:`timespan$(); submittime:`timestamp$(); returntime:`timestamp$(); status:`boolean$(); stage:`$()); @@ -37,7 +37,7 @@ wrapper:{[name;query;qid] csvloader:{[CSV] /- rethrows error if file doesn't exist, checks to see if correct columns exist in file - t:@[{write[`long$0;"Opening ",x;0b];("s**s*Ssuuun*";enlist "|") 0: hsym `$x};CSV;{.lg.e[`csvloader;e:"failed to open ",x," : ",y];'e}[CSV]]; + t:@[{write[`long$0;"Opening ",x;0b];("s**s*Ssuuun*s";enlist "|") 0: hsym `$x};CSV;{.lg.e[`csvloader;e:"failed to open ",x," : ",y];'e}[CSV]]; /- Replace Nested list string with actual nested list t:update daysofweek:value each daysofweek, query:raze each query, proctype:raze each `$" " vs' string proctype from t; @@ -45,7 +45,7 @@ csvloader:{[CSV] $[not all (cols reports) in cols t; '"The file (",CSV,") has incorrect layout"; / - check if there are any null values or empty strings in required columns - any (not count each raze value exec query,resulthandler from t),null raze/[value flip delete query,resulthandler,joinfunction,gateway,procname from t]; + any (not count each raze value exec query,resulthandler from t),null raze/[value flip delete query,resulthandler,joinfunction,gateway,procname,timezone from t]; '"File not loaded, null values were found in the csv file"; / - cannot query against more than one processes when server is not a gateway process any 1tRL2MM3HA!V^$EU+dr!;?7A?d*9a`8&~ RD5A9f)O}Z`&oM)dxdF>GHjV%Q literal 0 HcmV?d00001 diff --git a/config/filealerterprocessed/filesize b/config/filealerterprocessed/filesize new file mode 100644 index 0000000000000000000000000000000000000000..0fc7d496094558618dbc08d22a48c7171519dd73 GIT binary patch literal 32 UcmeyTz|MdSd>J9UDgg)$04=cr{r~^~ literal 0 HcmV?d00001 diff --git a/config/filealerterprocessed/md5hash b/config/filealerterprocessed/md5hash new file mode 100644 index 0000000000000000000000000000000000000000..e984b0d4c1879ca7354debf5a0d045d8bd4aea96 GIT binary patch literal 4112 zcmeIuu?+wq3WvB`VWs@Ddq$r_P=7;)sW|o4Rlg_a@p33vqq{26q$v literal 0 HcmV?d00001 diff --git a/config/reporter.csv b/config/reporter.csv index b63dc5331..c27d63773 100644 --- a/config/reporter.csv +++ b/config/reporter.csv @@ -1 +1 @@ -name|query|resulthandler|gateway|joinfunction|proctype|procname|start|end|period|timeoutinterval|daysofweek +name|query|resulthandler|gateway|joinfunction|proctype|procname|start|end|period|timeoutinterval|daysofweek|timezone From 1b42b85cb8333e927e3f1c8234f278efd06cc621 Mon Sep 17 00:00:00 2001 From: koconnor99-aq Date: Thu, 21 Mar 2024 16:22:13 +0000 Subject: [PATCH 2/8] Removing unwanted files from a commit --- config/filealerterprocessed/.d | Bin 34 -> 0 bytes config/filealerterprocessed/filename | Bin 4112 -> 0 bytes config/filealerterprocessed/filename# | Bin 4238 -> 0 bytes config/filealerterprocessed/filesize | Bin 32 -> 0 bytes config/filealerterprocessed/md5hash | Bin 4112 -> 0 bytes config/filealerterprocessed/md5hash# | Bin 4164 -> 0 bytes 6 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 config/filealerterprocessed/.d delete mode 100644 config/filealerterprocessed/filename delete mode 100644 config/filealerterprocessed/filename# delete mode 100644 config/filealerterprocessed/filesize delete mode 100644 config/filealerterprocessed/md5hash delete mode 100644 config/filealerterprocessed/md5hash# diff --git a/config/filealerterprocessed/.d b/config/filealerterprocessed/.d deleted file mode 100644 index 055eeed171522e5d1180f42053d7a7e7fadfa8d6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 34 jcmey*$jtx(X_+~xd5O8H47n+$8HvRiV1eSys#FF5q!|iQ diff --git a/config/filealerterprocessed/filename b/config/filealerterprocessed/filename deleted file mode 100644 index faa1727932c5c02cdfcad01031c185609d9c2f3b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4112 zcmeIuu?+wq3tRL2MM3HA!V^$EU+dr!;?7A?d*9a`8&~ RD5A9f)O}Z`&oM)dxdF>GHjV%Q diff --git a/config/filealerterprocessed/filesize b/config/filealerterprocessed/filesize deleted file mode 100644 index 0fc7d496094558618dbc08d22a48c7171519dd73..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32 UcmeyTz|MdSd>J9UDgg)$04=cr{r~^~ diff --git a/config/filealerterprocessed/md5hash b/config/filealerterprocessed/md5hash deleted file mode 100644 index e984b0d4c1879ca7354debf5a0d045d8bd4aea96..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4112 zcmeIuu?+wq3WvB`VWs@Ddq$r_P=7;)sW|o4Rlg_a@p33vqq{26q$v From 8a7146c34242fb50cdd332961ffe35c52e4f9861 Mon Sep 17 00:00:00 2001 From: koconnor99-aq Date: Wed, 10 Apr 2024 10:50:57 +0100 Subject: [PATCH 3/8] changing startts endts to account for -localtime flag and nextperiod to accept new timestamp parameters --- code/processes/reporter.q | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/code/processes/reporter.q b/code/processes/reporter.q index 3725af112..4b0d90b24 100644 --- a/code/processes/reporter.q +++ b/code/processes/reporter.q @@ -64,9 +64,9 @@ datecheck:{ /- returns next nearest period timestamp, if period is 00:00:00 it will return start time and only runs once. nextperiod:{[start;end;period;curr] - `timestamp$ .proc.cd[] + $[0i=`int$period; + $[0i=`int$period; start; - first d where (d:s + sums 0,(`int$((`time$end)-s:`time$start)%p)#p:`time$period) >= `time$curr]} + first d where (d:start + sums 0,(`int$((`time$end)-s:`time$start)%p)#p:`time$period) >= `time$curr]} /- checks if any queries have timed out checktimeout:{ @@ -116,12 +116,12 @@ runreport:{[tab] `..timerids upsert 1!select id,periodend:nextrun from .timer.timer where fp~/:funcparam; :()]; / - if timezone is specified convert the start and end timestamps to the time used by the system - startts:?[not null tab[`timezone];ltime[.tz.ttz[`GMT;tab[`timezone];startts]];startts]; - endts:?[not null tab[`timezone];ltime[.tz.ttz[`GMT;tab[`timezone];endts]];endts]; + startts:?[not null tab[`timezone];.tz.ttz[`GMT;tab[`timezone];gtime[startts]];startts]; + endts:?[not null tab[`timezone];.tz.ttz[`GMT;tab[`timezone];gtime[endts]];endts]; / - if the current time is within the start and end timestamps, use current time as start time, else use the startts / - work out the start time for the timer. For example a report could run every day from 10am to 6pm every 5 mins, if the reporter / - is started at 1:11pm, we need to know that the report should start 1:15pm and then run every 5 mins there after - startts: nextperiod[startts;endts;tab`period;] $[.proc.cp[] within startts,endts;.proc.cp[];startts]; + / startts: nextperiod[startts;endts;tab`period;] $[.proc.cp[] within startts,endts;.proc.cp[];startts]; / - escape if the report havs already been registered on the timer if[count select from .timer.timer where fp~/:funcparam;:()]; / - register the report on the timer From a4599191a9e27e6d67a4e9e6e33acdbf232e9483 Mon Sep 17 00:00:00 2001 From: koconnor99-aq Date: Wed, 10 Apr 2024 11:01:42 +0100 Subject: [PATCH 4/8] Removing unwanted / --- code/processes/reporter.q | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/processes/reporter.q b/code/processes/reporter.q index 4b0d90b24..2a69c5175 100644 --- a/code/processes/reporter.q +++ b/code/processes/reporter.q @@ -121,7 +121,7 @@ runreport:{[tab] / - if the current time is within the start and end timestamps, use current time as start time, else use the startts / - work out the start time for the timer. For example a report could run every day from 10am to 6pm every 5 mins, if the reporter / - is started at 1:11pm, we need to know that the report should start 1:15pm and then run every 5 mins there after - / startts: nextperiod[startts;endts;tab`period;] $[.proc.cp[] within startts,endts;.proc.cp[];startts]; + startts: nextperiod[startts;endts;tab`period;] $[.proc.cp[] within startts,endts;.proc.cp[];startts]; / - escape if the report havs already been registered on the timer if[count select from .timer.timer where fp~/:funcparam;:()]; / - register the report on the timer From cefee4ca85ef55f82e88b8502d0d575592a1818a Mon Sep 17 00:00:00 2001 From: koconnor99-aq Date: Wed, 10 Apr 2024 13:14:35 +0100 Subject: [PATCH 5/8] adding considerations for non UK users who have localtime off --- code/processes/reporter.q | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/processes/reporter.q b/code/processes/reporter.q index 2a69c5175..b0e333f5b 100644 --- a/code/processes/reporter.q +++ b/code/processes/reporter.q @@ -116,8 +116,8 @@ runreport:{[tab] `..timerids upsert 1!select id,periodend:nextrun from .timer.timer where fp~/:funcparam; :()]; / - if timezone is specified convert the start and end timestamps to the time used by the system - startts:?[not null tab[`timezone];.tz.ttz[`GMT;tab[`timezone];gtime[startts]];startts]; - endts:?[not null tab[`timezone];.tz.ttz[`GMT;tab[`timezone];gtime[endts]];endts]; + startts:?[not null tab[`timezone];.tz.ttz[`GMT;tab[`timezone];?[`localtime in .proc.params;gtime[startts];startts]];startts]; + endts:?[not null tab[`timezone];.tz.ttz[`GMT;tab[`timezone];?[`localtime in .proc.params;gtime[endts];endts]];endts]; / - if the current time is within the start and end timestamps, use current time as start time, else use the startts / - work out the start time for the timer. For example a report could run every day from 10am to 6pm every 5 mins, if the reporter / - is started at 1:11pm, we need to know that the report should start 1:15pm and then run every 5 mins there after From 08563c3cccbb53794b47e3776af73d3155115df7 Mon Sep 17 00:00:00 2001 From: koconnor99-aq Date: Wed, 10 Apr 2024 13:25:19 +0100 Subject: [PATCH 6/8] cleaning up the conditional --- code/processes/reporter.q | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/processes/reporter.q b/code/processes/reporter.q index b0e333f5b..0518153e5 100644 --- a/code/processes/reporter.q +++ b/code/processes/reporter.q @@ -116,8 +116,8 @@ runreport:{[tab] `..timerids upsert 1!select id,periodend:nextrun from .timer.timer where fp~/:funcparam; :()]; / - if timezone is specified convert the start and end timestamps to the time used by the system - startts:?[not null tab[`timezone];.tz.ttz[`GMT;tab[`timezone];?[`localtime in .proc.params;gtime[startts];startts]];startts]; - endts:?[not null tab[`timezone];.tz.ttz[`GMT;tab[`timezone];?[`localtime in .proc.params;gtime[endts];endts]];endts]; + startts:?[not null tab[`timezone];.tz.ttz[`GMT;tab[`timezone];$[.proc.localtime;gtime[startts];startts]];startts]; + endts:?[not null tab[`timezone];.tz.ttz[`GMT;tab[`timezone];?[.proc.localtime;gtime[endts];endts]];endts]; / - if the current time is within the start and end timestamps, use current time as start time, else use the startts / - work out the start time for the timer. For example a report could run every day from 10am to 6pm every 5 mins, if the reporter / - is started at 1:11pm, we need to know that the report should start 1:15pm and then run every 5 mins there after From 4c33ccbe7cff78104131dc863f7a4df5821939b4 Mon Sep 17 00:00:00 2001 From: koconnor99-aq <124678502+koconnor99-aq@users.noreply.github.com> Date: Wed, 10 Apr 2024 13:52:15 +0100 Subject: [PATCH 7/8] Update code/processes/reporter.q Co-authored-by: Jonathon McMurray --- code/processes/reporter.q | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/processes/reporter.q b/code/processes/reporter.q index 0518153e5..ed94caf1c 100644 --- a/code/processes/reporter.q +++ b/code/processes/reporter.q @@ -117,7 +117,7 @@ runreport:{[tab] :()]; / - if timezone is specified convert the start and end timestamps to the time used by the system startts:?[not null tab[`timezone];.tz.ttz[`GMT;tab[`timezone];$[.proc.localtime;gtime[startts];startts]];startts]; - endts:?[not null tab[`timezone];.tz.ttz[`GMT;tab[`timezone];?[.proc.localtime;gtime[endts];endts]];endts]; + endts:?[not null tab[`timezone];.tz.ttz[`GMT;tab[`timezone];$[.proc.localtime;gtime[endts];endts]];endts]; / - if the current time is within the start and end timestamps, use current time as start time, else use the startts / - work out the start time for the timer. For example a report could run every day from 10am to 6pm every 5 mins, if the reporter / - is started at 1:11pm, we need to know that the report should start 1:15pm and then run every 5 mins there after From b4d1e36eccae2b611a578cc14e3a5355ab29024c Mon Sep 17 00:00:00 2001 From: koconnor99-aq <124678502+koconnor99-aq@users.noreply.github.com> Date: Wed, 10 Apr 2024 15:59:37 +0100 Subject: [PATCH 8/8] Update reporter.q --- code/processes/reporter.q | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/processes/reporter.q b/code/processes/reporter.q index ed94caf1c..afa546c08 100644 --- a/code/processes/reporter.q +++ b/code/processes/reporter.q @@ -116,8 +116,8 @@ runreport:{[tab] `..timerids upsert 1!select id,periodend:nextrun from .timer.timer where fp~/:funcparam; :()]; / - if timezone is specified convert the start and end timestamps to the time used by the system - startts:?[not null tab[`timezone];.tz.ttz[`GMT;tab[`timezone];$[.proc.localtime;gtime[startts];startts]];startts]; - endts:?[not null tab[`timezone];.tz.ttz[`GMT;tab[`timezone];$[.proc.localtime;gtime[endts];endts]];endts]; + startts:?[not null tab[`timezone];.tz.ttz[`GMT;tab[`timezone];$[.proc.localtime;gtime[startts];startts]];startts]; + endts:?[not null tab[`timezone];.tz.ttz[`GMT;tab[`timezone];$[.proc.localtime;gtime[endts];endts]];endts]; / - if the current time is within the start and end timestamps, use current time as start time, else use the startts / - work out the start time for the timer. For example a report could run every day from 10am to 6pm every 5 mins, if the reporter / - is started at 1:11pm, we need to know that the report should start 1:15pm and then run every 5 mins there after