Skip to main content

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.

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.3.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

run-0.3-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: run-0.3.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for run-0.3.tar.gz
Algorithm Hash digest
SHA256 4fedf927ccee02e797912af574d31a6d394073716db6864beb2bb75e05df3f36
MD5 e6ed15c13966ed90352b37242f01f071
BLAKE2b-256 7bddbe134411d3f2bf7e216e37d7136ed6bae74f06dc1683d929c5ca9bfcdb3c

See more details on using hashes here.

File details

Details for the file run-0.3-py3-none-any.whl.

File metadata

  • Download URL: run-0.3-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for run-0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 93600874ef1f7de3b178efe6607db32afb4ff45acdf640c76bbed851f6494a60
MD5 bd6defb9426f54680f6bcf97cd1f9b15
BLAKE2b-256 e15df831e942a2ed684564bd099ac22f5e8ae0e9cbf45814f471565248ec875b

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.3 This release

2 files

0.2

1 file

0.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page