Skip to content

Add missing fields in timer object.#110

Merged
vrdmr merged 7 commits intodevfrom
pdthummar/bug858
Apr 5, 2022
Merged

Add missing fields in timer object.#110
vrdmr merged 7 commits intodevfrom
pdthummar/bug858

Conversation

@pdthummar
Copy link
Copy Markdown
Contributor

@pdthummar pdthummar commented Mar 30, 2022

Added missing fields in timer object.
Fixes: Azure/azure-functions-python-worker#681
Fixes: Azure/azure-functions-python-worker#858

Missing fields

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 30, 2022

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%) ⬆️

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%) ⬆️

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.

Comment thread azure/functions/timer.py
Comment thread azure/functions/timer.py Outdated
Comment thread azure/functions/timer.py Outdated
Comment thread tests/test_timer.py Outdated
Comment thread azure/functions/timer.py Outdated
Comment thread azure/functions/timer.py Outdated
@pdthummar pdthummar changed the title Pdthummar/bug858 Add missing fields in timer object. Mar 30, 2022
@pdthummar pdthummar requested review from gavin-aguiar and vrdmr March 30, 2022 22:06
Copy link
Copy Markdown
Member

@vrdmr vrdmr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢
LGTM

Comment thread azure/functions/timer.py
Comment thread azure/functions/timer.py
from . import meta


class TimerRequest(azf_abc.TimerRequest):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@YunchuWang - Getting your input here - If we plan to add PyDocs here - what could we add here?

@pdthummar No need to worry in this PR (mostly). But we should explore adding more PyDoc comments as they eventually show up in azure.functions.timerrequest

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vrdmr would suggest giving a overview what this class does, adding definition of each field in init, and link to https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-timer?tabs=in-process&pivots=programming-language-java#attributes

Comment thread tests/test_timer.py
Comment thread tests/test_timer.py
Copy link
Copy Markdown
Contributor

@gavin-aguiar gavin-aguiar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vrdmr vrdmr merged commit d0d3f8f into dev Apr 5, 2022
@vrdmr vrdmr deleted the pdthummar/bug858 branch April 5, 2022 20:03
@lak-amith531
Copy link
Copy Markdown

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
Copy link
Copy Markdown
Contributor Author

@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
Copy link
Copy Markdown

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Missing fields in timer object TimeTrigger Azure Function Python API pass ScheduleStatus to function

6 participants