Hi community, yet another question need Prefect ma...
# prefect-community
t
Hi community, yet another question need Prefect masters’ wisdom. Anyone know how to specify “TimeZone” using the prefect deployment cli? I noticed that you can specify, say cron, via
prefect deployment build --cron "00 1 * * *"
But how can I specify timezone in cli like how it can be done through the python object interface (I am having a weird bug, i.e. some folder under /tmp/* could not be found if a python deployment get execute in the second time)? I searched a bit on Github but only found some python code, and I also tried to looked at the code implementation (on 2.3.0), but it’s not very clear to me where that TimeZone flag got specified (already got lost in the *args maze) Any help would be appreciated! 🙏🙏🙏
1
o
Hey, currently you can't set the timezone without manually modifying the deployment yaml files (or the schedule itself, using the GUI). See https://github.com/PrefectHQ/prefect/issues/6464 for more info and discussion.
🙏 1
t
ah, IC. Let’s wait on this then or let me know if extra hands could be helpful. I kinda need this feature because I set up my entire deployment workflow as a one-button thing, so manually change it via UI is not optimal. Or if that python interface doesn’t have that weird bug, I actually prefer the python interface for specifying something complicated.
o
# Add timezone to schedule, if the deployment build has a schedule.
if cron is not None:
with open(f"{flow_name_clean}-deployment.yaml") as r:
text = r.read().replace("timezone: null", "timezone: Europe/Stockholm")
with open(f"{flow_name_clean}-deployment.yaml", "w") as w:
w.write(text)
That's how I solve it for now, I run everything as a one-button thing too. Just run this hacky little code snippet after every deployment file has been created, before you call apply. 🙂
🙏 1
👍 1
t
ah, this is indeed a pretty good workaround, thanks!