Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing fields in timer object. #110

Merged
merged 7 commits into from
Apr 5, 2022
Merged

Add missing fields in timer object. #110

merged 7 commits into from
Apr 5, 2022

Conversation

pdthummar
Copy link
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

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.

azure/functions/timer.py Outdated Show resolved Hide resolved
azure/functions/timer.py Outdated Show resolved Hide resolved
azure/functions/timer.py Outdated Show resolved Hide resolved
tests/test_timer.py Outdated Show resolved Hide resolved
azure/functions/timer.py Outdated Show resolved Hide resolved
azure/functions/timer.py Outdated Show resolved Hide resolved
@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
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

azure/functions/timer.py Show resolved Hide resolved
@@ -5,19 +5,29 @@
import typing

from azure.functions import _abc as azf_abc

from . import meta


class TimerRequest(azf_abc.TimerRequest):
Copy link
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
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

tests/test_timer.py Show resolved Hide resolved
tests/test_timer.py Show resolved Hide resolved
Copy link
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

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
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

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