Skip to main content

Python Process Run Control

Project description

This module provides convenient ways to guarantee a certain script state.

run.alone

Make sure only one instance of the program is running, this is done by acquiring an fcntl file lock on the current script:

>>> import run.alone

Caveats

There are a few things to keep in mind:

  1. import run.alone once, it will exit your program if it gets imported twice

  2. symlinked scripts will be resolved to the inode it has been linked to, this is a limitiation of using fcltn file locks

run.until

Run until a specified timespec, if the process runs longer, it will be killed:

>>> import run
>>> run.until('23m42s')
>>> ...

You can also choose to limit on the amount of CPU-time being consumed (default is wall clock time):

>>> run.until('42s', 'cpu')
>>> ...

Acknowledgements

This module is dirived from the Sys::RunAlone and Sys::RunUntil perl modules written by Elizabeth Mattijsen.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

run-0.1.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

run-0.1-py2.6.egg (7.2 kB view details)

Uploaded Source

File details

Details for the file run-0.1.tar.gz.

File metadata

  • Download URL: run-0.1.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for run-0.1.tar.gz
Algorithm Hash digest
SHA256 e8c608fa03c99134ba52146910fb3485fe8e534b7ef04064d4d78552367392ff
MD5 08ba5933e6d5d1d4043aa56223e0f995
BLAKE2b-256 a52a762d257bf21bd095868ec1bc92924f826495dff16edbf01d18b9ae29db06

See more details on using hashes here.

File details

Details for the file run-0.1-py2.6.egg.

File metadata

  • Download URL: run-0.1-py2.6.egg
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for run-0.1-py2.6.egg
Algorithm Hash digest
SHA256 c902e80f42948cd95ff6d5a35703a4cec6fa516db9142c600660e7cbce3657b0
MD5 4a3aaeead9c229a27200e22e80526f19
BLAKE2b-256 fde3fa0cbe26e0510ecd54b484b57edd058fd5c91b07dfc57143edebbc9ab625

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page