Hi <#CL09KU1K7|prefect-community> :wave: Could any...
# prefect-community
i
Hi #prefect-community 👋 Could anyone point me to where the context object is populated? I've found that
prefect.context.scheduled_start_time
contains slightly different timezone information depending on whether I run the flow with
my_flow.run()
or whether it is run by the Docker agent. • Run with
my_flow.run()
the object as follows:
DateTime(2020, 9, 17, 13, 28, 18, 669528, tzinfo=Timezone('UTC')
. • Run by the Docker agent the object is as follows:
DateTime(2020, 9, 17, 13, 45, 0, tzinfo=Timezone('+00:00'))
. The distinction is important because they are both instances of
pendulum.DateTime
. Calling
<http://dt.to|dt.to>_iso8601_string()
results in a different string, because if the timezone is UTC, then this method replaces the trailing
+00:00
with
Z
. Whether or not this is a good idea, it would be good for
prefect.context.scheduled_start_time
to return consistent timezone information.
i
Thanks @Dylan I think at some stage, a
datetime.datetime
with a timezone of
datetime.timezone.utc
is making its way to
IntervalClock
. I'm not sure whether that's in my application code, in Prefect, or somewhere else. I'll try and investigate further.
👍 1
If I found the issue was in Prefect, then would you consider it a bug @Dylan? The issue isn’t that
prefect.context.scheduled_start_time
is wrong, as much as the same timezone having a different representation depending on the environment (Docker/non-Docker).
d
I don’t think I would consider that a bug as such, but if you were able to make them uniform that would be an improvement!
👍 1