Skip to main content

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

Demo of UI and CLI

Usage

usage: cli.py [-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: cli.py list [-h] [--format {text,csv,json}]

Sample output

$ ./cli.py 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: cli.py 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

$ ./cli.py lock fork1 'To eat or not to eat...'
Obtained lock for Resource(name='fork1')

Release a lock

usage: cli.py release [-h] resource

NOTE That only the locking user can release a lock.

Example

$ ./cli.py release fork1
Released lock for Resource(name='fork1')

======= History

0.1.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

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

lockmyresource-0.2.0-py2.py3-none-any.whl (29.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file lockmyresource-0.2.0-py2.py3-none-any.whl.

File metadata

  • Download URL: lockmyresource-0.2.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 29.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

Hashes for lockmyresource-0.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6410731c82a1bf39035008b6393938c2406580e01d9cf7776a37b6ad6de2571f
MD5 7698b58de554f688ec73c1e32cab3af5
BLAKE2b-256 f44f90e76d10906569fb9ea75ca23e706ca8e1be8d42a994429c09bf3f63a4c1

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