Skip to main content

Build Status

Synopsys

The ptimeout utility is a python script implementing an interface similar to GNU timeout with the additional ability to terminate all processes launched from the timeout session.

In order to terminate all processes launched as part of the timeout session, an environment variable is propagated along with processes creation.

This heuristic enables terminations of detached processes even when they are not anymore in the process parent-child tree.

This also avoids the usage of process groups or process session leadership which have some undesirable effect observed with timeout tools provided with standard distributions. This approach is thus more transparent w.r.t. to overall process management.

The limitation to this approach is when some process reset its environment, in which case it will not be tracked anymore (nor any of its child) by the termination heuristic. In this case the sub-process tree may not terminate as part of the timeout session.

Download

Download the last stable version of the script from there: https://raw.githubusercontent.com/guillon/ptimeout/master/ptimeout

Examples

A typical usage of such a tool if for limiting the time of a batch job which may fall into non terminating condition such as in validation scripts or test processes.

Also one generally expect the whole set of executed processes as part of the job lifetime to be teminated when the job terminates, hence the termination heuristic.

Example of usage for limiting a batch script to 1 hour duration:

$ ptimeout 3600 script.sh

By default script.sh and all process executed from its process tree will be terminated with SIGTERM after 3600 seconds, or killed by SIGKILL 10 seconds after if still persistent.

If one wants only process garbage collection, use a timeout of 0 as in:

$ ptimeout 0 script.sh

In this case, the tool will not bound the execution time, but will still garbage collect all processes when receiving an interrupting signal.

The usage of ptimeout can be recursive and there is not side effect with respect to interactive/sessions/tty modes.

Get the command line help with:

$ ptimeout --help
usage: ptimeout [-h] [-v] [-d] [-s SIGNAL] [-k KILL_AFTER] [-c CATCH_SIGNALS]
            [-l LIST] [-f FORMAT]
            [duration] [command] ...
....

Build and Install

This script requires python 2.6, 2.7 or 3.3+.

The script can be used directly without installation.

A makefile is provided anyway for completion and testing purpose.

Build with:

$ make all # a no-op actually

Run unittests with:

$ make check

Install with, for instance:

$ make install PREFIX=$HOME/local  # Default is PREFIX=/usr/local

References

Refer to the project home page at: http://guillon.github.com/ptimeout

Refer to the current build and validation status at: https://travis-ci.org/guillon/ptimeout?branches

Fill issues and enhancement request at: https://github.com/guillon/ptimeout/issues

License

The tool is distributed under the GPLv2 license.

Refer to the COPYING file: https://github.com/guillon/ptimeout/blob/master/COPYING Refer to the COPYRIGHT file: https://github.com/guillon/ptimeout/blob/master/COPYRIGHT

Metadata

Release files for ptimeout 1.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ptimeout 1.4.0
File Size Uploaded Provenance Actions
ptimeout-1.4.0.tar.gz 18.9 kB Without provenance Details for ptimeout-1.4.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for ptimeout 1.4.0
File Interpreter ABI Platform Actions
ptimeout-1.4.0-py3-none-any.whl Python 3 none any Details for ptimeout-1.4.0-py3-none-any.whl
ptimeout-1.4.0-py2-none-any.whl Python 2 none any Details for ptimeout-1.4.0-py2-none-any.whl

Total release size: 50.6 kB

Release files / ptimeout-1.4.0.tar.gz

Download URL ptimeout-1.4.0.tar.gz
Size 18.9 kB
Tags Source
SHA-256 checksum
How to use checksums
9a81d402e826ddcae758e79165ad6e7b568318c3052969f9b030d1375b137016
BLAKE2b-256 checksum
How to use checksums
ac5d69dd81836cd98b3fd2e769fdbe605398dac15de305fc93d8ed8b14dc1065
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.10

Release files / ptimeout-1.4.0-py3-none-any.whl

Download URL ptimeout-1.4.0-py3-none-any.whl
Size 15.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
334b8aca1a667719584fb07787c242c3b64a4deda6e23bec52dd8c2a2ce0f9e1
BLAKE2b-256 checksum
How to use checksums
2bd6adcc08e1861544ba77313fbec33d2dc6d94b6078c5774382bdad943eac5a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.10

Release files / ptimeout-1.4.0-py2-none-any.whl

Download URL ptimeout-1.4.0-py2-none-any.whl
Size 15.8 kB
Tags Python 2
SHA-256 checksum
How to use checksums
70e442523517039ab2f06809d66615e21b0cb2bddb28a7eb81425f67ca5e72c4
BLAKE2b-256 checksum
How to use checksums
d319bb997673a2eecbd56904ffb97da51a8e41d68428d7f4e49ba3dda9bc6071
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.10

Security for ptimeout 1.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.4.0 This release

3 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page