Skip to content

Bench484 eod called twice - #795

Open
danielhunter22 wants to merge 2 commits into
masterfrom
Bench484-EOD-called-twice
Open

danielhunter22 wants to merge 2 commits into
masterfrom
Bench484-EOD-called-twice

Conversation

@danielhunter22

Copy link
Copy Markdown

Bench484-EOD-Called-Twice: TorQ Issue 559

(link to issue raised: #559)

Problem

With rolltimezone set to ( America/New_York, rolltimeoffset -0D06:50), EOD runs twice when the clocks go back. The next roll is calculated just after the previous EOD, using the timezone offset at that moment (summer time). By the time the roll runs the clocks have changed, so the stored UTC time is an hour out:

  • Stored: 2020.11.01D21:10 UTC. Correct: 2020.11.01D22:10 UTC.
  • EOD fires an hour early (16:10 EST), recalculates, and fires again at 17:10 EST.

Changes (code/common/eodtime.q)

  • getroll: calculates the next roll in the roll timezone, then converts to UTC with .tz.gl, so the offset used is the one valid at the roll time.

quick checks

image
  • old code would have given 2020.11.01D21:10:00.000000000

Screenshot showing successful unit tests for EOD.
image

getroll converted the roll time to UTC using the timezone offset at
the time of calculation, not at the time the roll runs. When clocks
changed between the two, the next roll was stored an hour out, so EOD
fired early and then again (e.g. America/New_York, autumn: 21:10 UTC
stored instead of 22:10 UTC).

- getroll: calculate the next roll in the roll timezone, then convert
  to UTC with .tz.gl so the offset at the roll time is used
-load ${KDBTESTS}/helperfunctions.q ${testpath}/settings.q \
-results ${KDBTESTS}/stp/results/ \
-procfile ${testpath}/process.csv \
-debug \

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

think this is left from your testing if you can remove

run,0,0,q,now:.z.p,1,,"Get current time"
run,0,0,q,data:stpHandle".stplg.endofdaydata[]",1,,"get data"
run,0,0,q,"stpHandle(`.stplg.stpeod;.eodtime.d;data,(enlist `p)!enlist now)",1,,"Run EoD function on STP"
run,0,0,q,"stpHandle(`.stplg.endofday;.eodtime.d;data,(enlist `p)!enlist now)",1,,"Run EoD function on STP"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add some unit tests to cover the getroll behaviour we are making the fix for?
e.g. around midnight when the clocks change in NY/London/both

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do

Comment thread code/common/eodtime.q

// function to determine the date (in rolltimezone) from UTC timestamp, p
getday:{[p]
p+:adjtime[p]; // convert date from UTC to rolltimezone

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it may be an issue that you removed adjtime use in getroll but is left here, can we update this with the new use of .tz.lg[rolltimezone;p] too?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants