-
Notifications
You must be signed in to change notification settings - Fork 32
Feature: dynamic timeouts #228
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
Conversation
…et}}, {{__timeout_adjust}}
1 similar comment
|
@screamerbg Thanks for the PR. Do you need this in a release of htrun soon? |
|
@theotherjimmy Yes please (if possible). Here's an example usage - PelionIoT/simple-mbed-cloud-client@6cb6566#diff-82f388e30987a4563c237f17ccb185dbR66 |
bridadan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! Just a few suggestions regarding the keys.
| self.logger.prn_inf("%s received"% (key)) | ||
| callbacks__exit_event_queue = True | ||
| break | ||
| elif key == '__timeout_set': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The beginning of the test (the "preamble" as its referred to at the top of this file) sets the timeout of the test with the __timeout key. I'd say go ahead and reuse that key instead of making a new one, unless you have any objections.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The __timeout key at "preamble" stage also sets the global timer to 0 and timeout duration. The behavior of __timer_set only sets the timeout duration, but doesn't change the global timer (e.g. time elapsed). I'd prefer not to confuse these two different behaviors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a very good point, thanks very much for clarifying 😄
| # Dynamic timeout set | ||
| timeout_duration = int(value) # New timeout | ||
| self.logger.prn_inf("setting timeout to: %d sec"% int(value)) | ||
| elif key == '__timeout_adj': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tend to stay away from abbreviations if the full word is reasonably small. In this case __timeout_adjust is just three more characters. Would you mind "adjusting" (heh, couldn't resist 😄) this key?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. I'll "adj" it! 😄
As suggested by @bridadan
| self.logger.prn_inf("%s received"% (key)) | ||
| callbacks__exit_event_queue = True | ||
| break | ||
| elif key == '__timeout_set': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a very good point, thanks very much for clarifying 😄
|
Bump @cmonr @theotherjimmy |
cmonr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
| self.logger.prn_inf("setting timeout to: %d sec"% int(value)) | ||
| elif key == '__timeout_adjust': | ||
| # Dynamic timeout adjust | ||
| timeout_duration = timeout_duration + int(value) # adjust time |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was about to ask "what's the difference between adjust and set, but this was simple enough :)
This minimalistic PR adds support to dynamically sett/adjust a test timeout via DUT messages
{{__timeout_set,int}},{{__timeout_adjust,int}}.The is particularly useful when a device is making a download (say firmware update), where the speed might dynamically change based on various conditions. With this feature, the DUT might notify the host that it's alive and running, just slower than expected.
A typical usecase would be a unified IP connectivity test, where the time to complete over Ethernet and Wifi would be significantly faster than 2G/3G, let alone NBIoT/CAT-M1.
As discussed with @bridadan