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.

Release files for run 0.3

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

Source distribution (sdist)

Source distribution for run 0.3
File Size Uploaded
run-0.3.tar.gz 4.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for run 0.3
File Interpreter ABI Platform
run-0.3-py3-none-any.whl Python 3 none any Details

Total release size: 9.6 kB

Release files / run-0.3.tar.gz

Download URL run-0.3.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
4fedf927ccee02e797912af574d31a6d394073716db6864beb2bb75e05df3f36
BLAKE2b-256 checksum
How to use checksums
7bddbe134411d3f2bf7e216e37d7136ed6bae74f06dc1683d929c5ca9bfcdb3c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Release files / run-0.3-py3-none-any.whl

Download URL run-0.3-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
93600874ef1f7de3b178efe6607db32afb4ff45acdf640c76bbed851f6494a60
BLAKE2b-256 checksum
How to use checksums
e15df831e942a2ed684564bd099ac22f5e8ae0e9cbf45814f471565248ec875b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Release history Release notifications | RSS feed

This release

0.3 This release

2 release files

0.2

1 release file

0.1

2 release files

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