Coordinate locking resources for humans and machines using a simple sqlite file.
Project description
lockmyresource
Coordinate locking resources for humans and machines, using a simple sqlite DB
There is a CLI for machines and admins and a minimal tk GUI for lock&release.
Quick demo
Usage
usage: lockmyresource [-h] [--dbfile DBFILE] [--debug] {list,lock,release} ...
Lock some resources
positional arguments:
{list,lock,release} Commands
list List resources
lock Lock a resource
release Release a resource
optional arguments:
-h, --help show this help message and exit
--dbfile DBFILE Database to use
--debug
NOTE that the current user's username will be used for all operations.
NOTE the db will be created if it does not yet exist
List resources
usage: lockmyresource list [-h] [--format {text,csv,json}]
Sample output
$ lockmyresource list
Resource User Locked_at Comment
fork1 Hegel 2021-01-17 11:42:36.459921 Ideally, I can use fork1
fork2 Kant 2021-01-17 11:52:13.768924 Can't take fork1, I guess
spoon None None None
Lock existing / Create new resource and lock it
usage: lockmyresource lock [-h] resource comment
NOTE that the comment is mandatory.
NOTE that deletion of resources is not yet implemented, you need to manipulate the sqlite DB manually for now
Example
$ lockmyresource lock fork1 'To eat or not to eat...'
Obtained lock for Resource(name='fork1')
Release a lock
usage: lockmyresource release [-h] resource
NOTE That only the locking user can release a lock.
Example
$ lockmyresource release fork1
Released lock for Resource(name='fork1')
Wait for a lock to be released
usage: lockmyresource subscribe resource [shell-command]
NOTE Will not wait if it is the current user who has locked the resource
Examples
$ lockmyresource subscribe fork1 && aplay tada.wav
$ lockmyresource subscribe fork2 'start trigger.bat' --interval=10
======= History
0.4.0
- Try to use display name of users on windows
0.3.0 (2022-05-21)
- Show version number on the UI
- Subscribe: get notified when a resource becomes available
0.2.0 (2021-04-03)
- First release on PyPI.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file lockmyresource-0.4.0-py2.py3-none-any.whl
.
File metadata
- Download URL: lockmyresource-0.4.0-py2.py3-none-any.whl
- Upload date:
- Size: 31.7 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.14.0 pkginfo/1.7.0 requests/2.25.1 setuptools/54.2.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ea8f1b56cb88cf8f632f620746143546b73116e6a5c279644c8ba0b219850ba |
|
MD5 | 7a75ba8f1f46540b42b3e45a16765191 |
|
BLAKE2b-256 | 81511e20555ca00fe4f7722d2dcb6f5c0279bdb29970cc64fe3e9de1010d6f84 |