Released:
Celery Timeout decorator
You can set your phone settings, ProcessTimer is timer, tasker for android process. Forexample; set sounds, brightness, wallpaper and set start selected application etc. Then will be start process. 19:25:02 a22e53: INFO Job host started 19:25:14 270010: INFO Running in region: 'West Europe' 19:25:14 270010: INFO Development settings applied 19:25:14 270010: INFO Found the following functions: 19:25:14 270010: INFO xxxx.Jobs.KnowledgeCenterPump.
Project description
Installation
From source code:
python setup.py install
From pypi:
pip install process-timer
Usage
Specify an alternate exception to raise on timeout:
Multithreading
By default, timeout-decorator uses signals to limit the execution timeof the given function. This appoach does not work if your function isexecuted not in a main thread (for example if it's a worker thread ofthe web application). There is alternative timeout strategy for thiscase - by using multiprocessing. To use it, just passuse_signals=False
to the timeout decorator function:
WarningMake sure that in case of multiprocessing strategy for timeout, your function does not return objects which cannotbe pickled, otherwise it will fail at marshalling it between master and child processes.
Acknowledgement
- Timeout Decorator - https://github.com/pnpnpn/timeout-decorator
- http://www.saltycrane.com/blog/2010/04/using-python-timeout-decorator-uploading-s3/
- https://code.google.com/p/verse-quiz/source/browse/trunk/timeout.py
Contribute
I would love for you to fork and send me pull request for this project.Please contribute.
License
This software is licensed under the MIT license
See License file
Release historyRelease notifications | RSS feed
1.1.1
1.1
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size process_timer-1.1.1-py3-none-any.whl (5.6 kB) | File type Wheel | Python version py3 | Upload date | Hashes |
Filename, size process-timer-1.1.1.tar.gz (4.4 kB) | File type Source | Python version None | Upload date | Hashes |
Hashes for process_timer-1.1.1-py3-none-any.whl
Algorithm | Hash digest |
---|---|
SHA256 | 24199f6a2cf61de93b24435f9aa1f408cb494165a67a77724441a0de51aef408 |
MD5 | cb2757f44b9563c033a0c2419fcf6287 |
BLAKE2-256 | dad4c68545e7cec06bad5141387212c067316845ab03cde23d66c41f41b42575 |
Hashes for process-timer-1.1.1.tar.gz
Algorithm | Hash digest |
---|---|
SHA256 | f903e0a0c212ee4580f08fbd038323b1a925c9702df60f1fda918b573638c40f |
MD5 | 292268d8e8e8046a2e2bd380256fcde0 |
BLAKE2-256 | 56b249371c8102ad77f1d3fcc38e69e44d746abcc0a87c20f2d785a513719119 |
2 4 6 8 10 12 | JavaScript can be executed in time-intervals. This is called timing events. |
Timing Events
The window
object allows execution of code at specified time intervals.
These time intervals are called timing events.
The two key methods to use with JavaScript are:
setTimeout(function, milliseconds
)
Executes a function, after waiting a specified number of milliseconds.setInterval(function, milliseconds
)
Same as setTimeout(), but repeats the execution of the function continuously.
The setTimeout()
and setInterval()
are both methods of the HTML DOM Window object.
The setTimeout() Method
The window.setTimeout()
method can be written without the window prefix.
The first parameter is a function to be executed.
The second parameter indicates the number of milliseconds before execution.
Example
Click a button. Wait 3 seconds, and the page will alert 'Hello':
<script>
function myFunction() {
alert('Hello');
}
</script>
How to Stop the Execution?
The clearTimeout()
method stops the execution of the function specified in setTimeout().
The window.clearTimeout()
method can be written without the window prefix.
The clearTimeout()
method uses the variable returned from setTimeout()
:
clearTimeout(myVar);
If the function has not already been executed, you can stop the execution by calling the clearTimeout()
method:
Example
Same example as above, but with an added 'Stop' button:
<button>Stop it</button>
The setInterval() Method
The setInterval()
method repeats a given function at every given time-interval.
The window.setInterval()
method can be written without the window prefix.
The first parameter is the function to be executed.
The second parameter indicates the length of the time-interval between each execution.
This example executes a function called 'myTimer' once every second (like a digital watch).
Example
Display the current time:
function myTimer() {
var d = new Date();
document.getElementById('demo').innerHTML = d.toLocaleTimeString();
}
How to Stop the Execution?
The clearInterval()
method stops the executions of the function specified in the setInterval() method.
The window.clearInterval()
method can be written without the window prefix.
The clearInterval()
method uses the variable returned from setInterval()
:
clearInterval(myVar);
Example
Same example as above, but we have added a 'Stop time' button:
<button>Stop time</button>
<script>
var myVar = setInterval(myTimer, 1000);
function myTimer() {
var d = new Date();
document.getElementById('demo').innerHTML = d.toLocaleTimeString();
}
</script>