Azure / azure-functions-python-library

Azure Functions Python SDK
MIT License
151 stars 63 forks source link

Add missing fields in timer object. #110

Closed pdthummar closed 2 years ago

pdthummar commented 2 years ago

Added missing fields in timer object. Fixes: https://github.com/Azure/azure-functions-python-worker/issues/681 Fixes: https://github.com/Azure/azure-functions-python-worker/issues/858

Missing fields

codecov[bot] commented 2 years ago

Codecov Report

Merging #110 (8d0e018) into dev (681daae) will increase coverage by 0.26%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##              dev     #110      +/-   ##
==========================================
+ Coverage   84.39%   84.66%   +0.26%     
==========================================
  Files          46       46              
  Lines        2711     2719       +8     
  Branches      363      363              
==========================================
+ Hits         2288     2302      +14     
+ Misses        349      343       -6     
  Partials       74       74              
Flag Coverage Δ
unittests 84.66% <100.00%> (+0.26%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
azure/functions/timer.py 100.00% <100.00%> (+31.57%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 681daae...8d0e018. Read the comment docs.

lak-amith531 commented 1 year ago

I am still unable to access those properties.

When I use str,

def main(mytimer: str) -> None:
    print(mytimer)

Output:
'{"Schedule":{"AdjustForDST":true},"ScheduleStatus":{"Last":"2022-09-28T17:20:28.2585574+05:30","Next":"2022-09-28T17:21:00+05:30","LastUpdated":"2022-09-28T17:20:28.2585574+05:30"},"IsPastDue":false}'

When I use func.TimerRequest

def main(mytimer: func.TimerRequest) -> None:
    print(mytimer.schedule_status)

Output:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: 'TimerRequest' object has no attribute 'schedule_status'
pdthummar commented 1 year ago

@lak-amith531 If you are using old Coretools version, Can you please upgrade it to latest version and try it? It should work with latest version.

If you are still facing issue after upgrading version, please create an issue with including replication steps. Thanks

tim-sparq commented 1 year ago

this doesn't work when schedule is more frequent than 1x p/min, even when useMonitor is set to true in function.json