Skip to content

Timezone issue described in #593 #595

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 3, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions changehc/delphi_changehc/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ def run_module():
make_asserts(params)

if params["drop_date"] is None:
# files are dropped about 8pm the day after the issue date
dropdate_dt = (datetime.now() - timedelta(days=1,hours=20))
# files are dropped about 4pm the day after the issue date
dropdate_dt = (datetime.now() - timedelta(days=1,hours=16))
dropdate_dt = dropdate_dt.replace(hour=0,minute=0,second=0,microsecond=0)
Comment on lines +89 to 90
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you say more about what this does? If they post more than an hour earlier or later, what will happen?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we run this script at 4:01 and they had posted the files already at 3, then the script will execute properly.

If they consistently post the files late, then I'm pretty sure the code will throw some sort of "File not found" error. It uses dropdate_dt to determine the filenames, so it will expect there to be files from yesterday, but the code can only download files from two days ago.

If CHNG posts the files at 5pm one day and at 4pm the next, and we run the code between 4pm and 5pm, the code will throw an assertion error because it found too many files dropped within the last 24 hours.

This code followed the outline of the HSP download scheme, but maybe a simpler solution is to compute the expected filename beforehand and check if it's been uploaded to their server yet. This way the errors would be more intelligible. For now, if we run the script after 8, everything should work properly.

Copy link
Contributor

Choose a reason for hiding this comment

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

compute the expected filename beforehand

Yep, this sounds ideal going forward. I'll put this PR through as-is and make a tracking issue for the refactor.

else:
dropdate_dt = datetime.strptime(params["drop_date"], "%Y-%m-%d")
Expand Down