Skip to main content

Useful tools to work with Rlocker project API

Quick Start

Normal installation

pip install rlockertools

Setup

git clone https://github.com/red-hat-storage/rlockertools.git
cd rlockertools
python -m venv venv
source venv/bin/activate
pip install ./
rlock --help

usage: rlock [-h] --server-url SERVER_URL --token TOKEN [--release] [--lock] [--resume-on-connection-error] [--signoff SIGNOFF] [--priority PRIORITY] [--search-string SEARCH_STRING] [--link LINK] [--interval INTERVAL] [--attempts ATTEMPTS]

optional arguments: -h, --help show this help message and exit --server-url SERVER_URL The URL of the Resource Locker Server --token TOKEN Token of the user that creates API calls --release Use this argument to release a resource --lock Use this argument to lock a resource --resume-on-connection-error Use this argument in case you don't want to break queue execution in the middle of waiting for queue status being FINISHED --signoff SIGNOFF Use this when lock=True, locking a resource requires signoff --priority PRIORITY Use this when lock=True, specify the level of priority the resource should be locked --search-string SEARCH_STRING Use this when lock=True, specify the lable or the name of the lockable resource --link LINK Use this when lock=True, specify the link of the CI/CD pipeline that locks the resource --interval INTERVAL Use this when lock=True, how many seconds to wait between each call while checking for a free resource --attempts ATTEMPTS Use this when lock=True, how many times to create an API call that will check for a free resource


## Usage Examples

### To add a queue for locking a resource

```bash
rlock --lock --server-url=your.rlocker.instance.com --token=YOURTOKEN --search-string=nameorlabel --signoff=YOURUNIQUESIGNOFF --priority=3 --interval=15 --attempts=15

To release a locked resource (filtration by signoff only)

rlock --release --server-url=your.rlocker.instance.com --token=YOURTOKEN --signoff=YOURUNIQUESIGNOFF

Logging Configuration

The rlockertools library uses Python's standard logging module. By default, logging is disabled (NullHandler). To enable logging output, configure it in your application:

Basic Configuration

import logging

# Configure logging at the start of your application
logging.basicConfig(
    level=logging.INFO,
    format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
)

Advanced Configuration

import logging

# Create a logger for rlockertools
logger = logging.getLogger('rlockertools')
logger.setLevel(logging.DEBUG)

# Create console handler with a higher log level
ch = logging.StreamHandler()
ch.setLevel(logging.INFO)

# Create formatter and add it to the handler
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
ch.setFormatter(formatter)

# Add the handler to the logger
logger.addHandler(ch)

Log Levels

  • DEBUG: Detailed information, typically for diagnosing problems (includes API responses)
  • INFO: General informational messages (connection status, resource operations)
  • WARNING: Warning messages (retries, timeouts)
  • ERROR: Error messages (failures, connection errors)

Metadata

Release files for rlockertools 0.4.8

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

Source distribution (sdist)

Source distribution for rlockertools 0.4.8
File Size Uploaded Provenance
rlockertools-0.4.8.tar.gz 12.8 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 24.8 kB

Release files / rlockertools-0.4.8.tar.gz

Download URL rlockertools-0.4.8.tar.gz
Size 12.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c4915f201e082c73b3637bd600d359011c77a6d30b830c3a9ac1e3872819c5bb
BLAKE2b-256 checksum
How to use checksums
420c3e1a7102db5b0ae2b259cf8f9c3a6ca4dc45e9a400a2224c3bb0dec291f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.13

Release files / rlockertools-0.4.8-py3-none-any.whl

Download URL rlockertools-0.4.8-py3-none-any.whl
Size 12.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
36528f98dd4e1d3675ce68aefb8f01ef42dbc16def9f300b653a2395b10db1ae
BLAKE2b-256 checksum
How to use checksums
fe234e3f7c69e59bcaafc5148cae786c3b3d5256ed567d17c03f2a76ad4e9631
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.13

Security for rlockertools 0.4.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.4.8 This release

2 release files No provenance

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