Comments (5)
I don't see a direct way to specify that a phase should be repeated until x
time has passed (you can set a timeout, but that's not exactly what you're asking about here). I'd suggest setting a measurement that records the start time, and then running a phase on repeat until the desired time has passed. In that phase you can check this measurement and return PhaseResult.REPEAT
until the desired amount of time has passed.
from openhtf.
Hey, thanks for the response. Yeah, this kind of functionality might be out of the design goals of the library, however, something along the lines of
#: runs for 60 secods, with a .5 sleep in between the runs
@htf.PhaseOptions(looping=True, interval=.5, duration=60)
def polling_test():
pass
def main():
test = htf.Test(
#: this behaviour should spawn a threading.Thread instead,
#: and skip right into the next phase
polling_test,
some_other_phase
)
test.execute()
if __name__ == '__main__':
main()
would be extremely useful.
from openhtf.
Agreed it would be useful! One question I have is how do you make a phase run for exactly the amount of time specified "from outside the phase" i.e. from the framework. E.g. in your example, is polling_test
run in a thread for 60 seconds, at the end of which the thread is terminated and a new one is started?
I suppose your use case could be met by adding a repeat_duration
(perhaps with a better name) that works like repeat_limit
but instead measures total time rather than number of repeats.
from openhtf.
In my concrete example, I imagined the polling_test
runs the phase body while the timeout
has not been reached yet, the thread sleeps for the specified interval
.
So, I would suppose it would run something along the lines of:
- measure current time
- time passed? if yes, stop/return from the thread.
- run the phase body
- sleep for the
interval
- repeat ;)
edit: the question was initially about the current functionality of the library, but seeing as such stuff isn't supported just yet, would we be able to achieve such feats sooner or later? thanks!
from openhtf.
if anyone is wondering - you should look into the "core.monitors" file.
from openhtf.
Related Issues (20)
- If plug configuration is dynamic (e.g. configs loaded from a file), how can the decorators be updated accordingly? HOT 2
- frontend_example with PyInstaller HOT 3
- Running a phase in backgroud HOT 7
- Request: Add ability to FAIL_AND_CONTINUE instead of STOP when a Phase reaches max_repeats
- How to build a test running multiple test groups concurrently, but showing I/O data of all test groups on the same webpage? HOT 1
- multiple monitors for a single phase?
- KeyError in `PlugManager.provide_plugs` HOT 6
- monitors decorator does not fully copy the specification of the monitored phase
- Feature Request(?): Provide a mechanism for displaying images in the front-end HOT 1
- Progress bar/completion status stops if test is marked as FAIL. HOT 4
- How could I call a PhaseDescriptor explicitly? HOT 3
- runtime reporting/logging for each phase during test HOT 6
- Having trouble using the unit test decorator @test.patch_plugs to mock a device I'm testing. HOT 3
- where PyOpenSSL is used?
- Unused `six` import in monitor code
- Replacing `M2Crypto` dependency with `cryptography`
- Status LED on failure HOT 1
- Multiple tests or one test and multiple subtests?
- Best practice on how to organize product-dependent tests
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openhtf.