Background : Triggering a CF via Cloud Scheduler: Image below: Its scheduled to run at 7 am Australia/Sydney time and trigger two cloud functions:
Cloud Function : Regions is us-central1. Code used :
# Global variable:
tz=pytz.timezone('Australia/Sydney')
naive_dt = datetime.now(tz=tz)
since = datetime.strftime(naive_dt - timedelta(1), '%Y-%m-%d') #yesterday's date
until = datetime.strftime(naive_dt - timedelta(1), '%Y-%m-%d') #yesterday's date
def honda_reporting_automation(event,context):
print("New Day")
print("current Function Execution date time",naive_dt)
print("since",since)
print("until",until)
Weird cloud function behaviour: 1. Though the cloud scheduler triggers the job at 7:00 am, and I have set the server timing to my local timing in my code, still the timing of execution differs.It takes US Timings(1 day lag) (Image below)
- 2nd Cloud function shows different time of start(a difference of 4 mins from 1st one) , though triggered at the same time by the same scheduler.
- When triggered manually via Cloud Scheduler using "Run now" option, they behave as expected and shows correct timings. (image 3)
anyone came across this weird behaviour ? and any idea how to resolve it ?