Skip to content

Commit

Permalink
Set parsed date timezone to MTL
Browse files Browse the repository at this point in the history
  • Loading branch information
notoraptor committed Sep 23, 2024
1 parent 8a13a95 commit 3562a87
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions sarc/alerts/usage_alerts/cluster_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,13 @@ def check_cluster_response(time_interval: timedelta = timedelta(days=7)):
# NB: We assume cluster's `end_date` is stored as a date string,
# so we must first convert it to a datetime object.
# `en_date` is parsed the same way as start/end parameters in `get_jobs()`.
cluster_end_date = datetime.combine(
datetime.strptime(cluster.end_date, "%Y-%m-%d"), time.min
).replace(tzinfo=TZLOCAL)
cluster_end_date = (
datetime.combine(
datetime.strptime(cluster.end_date, "%Y-%m-%d"), time.min
)
.replace(tzinfo=TZLOCAL)
.astimezone(MTL)
)
# Now we can check.
if cluster_end_date < oldest_allowed_date:
logger.warning(
Expand Down

0 comments on commit 3562a87

Please sign in to comment.