Looper is a daemonizer library, it can help you with lifecycle of your daemon.
Project description
GenesisCoreLibs Looper Documentation
Overview
GCL Looper is a Python library designed to create daemon-like services that can run indefinitely, performing tasks at regular intervals or on demand.
Usage Examples
Basic Service
- Iterate infinitely
- There should be at least 5 seconds between start of previous and next iteration (
iter_min_period) - pause for 1 second between iterations (
iter_pause)
from gcl_looper.services import basic
class MyService(basic.BasicService):
def __init__(self, iter_min_period=5, iter_pause=1):
super(MyService, self).__init__(iter_min_period, iter_pause)
def _iteration(self):
print("Iteration", self._iteration_number)
service = MyService()
service.start()
Finite Service without any pauses in-between
from gcl_looper.services import basic
class MyFiniteService(basic.BasicService):
def __init__(self, iter_min_period=0, iter_pause=0):
super(MyFiniteService, self).__init__(iter_min_period, iter_pause)
self.countdown = 3
def _iteration(self):
if self.countdown > 1:
self.countdown -= 1
else:
self.stop()
service = MyFiniteService()
service.start()
Public interface:
start(): Starts the service.stop(): Stop the service._loop_iteration(): Performs one iteration of the service loop.
Implement these methods to get usable service:
_iteration(): This method must be implemented by subclasses to perform the actual work at each iteration.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gcl_looper-0.1.0.tar.gz.
File metadata
- Download URL: gcl_looper-0.1.0.tar.gz
- Upload date:
- Size: 12.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e6f552e05a768c541bc42dcf4f5f2dd7c831319001576f1b279dace2e3622b0
|
|
| MD5 |
5d9232a323e867a237c2604f437b19be
|
|
| BLAKE2b-256 |
c4d9ffcf0aad6b5ff66e52cd1c833b930dbd6c454b6dd9c8d8af26fd32830321
|
Provenance
The following attestation bundles were made for gcl_looper-0.1.0.tar.gz:
Publisher:
publish-to-pypi.yml on infraguys/gcl_looper
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gcl_looper-0.1.0.tar.gz -
Subject digest:
5e6f552e05a768c541bc42dcf4f5f2dd7c831319001576f1b279dace2e3622b0 - Sigstore transparency entry: 171819955
- Sigstore integration time:
-
Permalink:
infraguys/gcl_looper@18ce5e1417d14c2e936c5daac63f02084fd53604 -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/infraguys
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@18ce5e1417d14c2e936c5daac63f02084fd53604 -
Trigger Event:
push
-
Statement type:
File details
Details for the file gcl_looper-0.1.0-py3-none-any.whl.
File metadata
- Download URL: gcl_looper-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
11d62789cca9df02aaba456382af61ea89fd11a08a7cf5202e1678f5d8e6f448
|
|
| MD5 |
c2c59f393f3363edc3fcb24cee145e60
|
|
| BLAKE2b-256 |
c5314041f4c4ae2065b9fea03c975114b2479be897355465858a2d59e26b0509
|
Provenance
The following attestation bundles were made for gcl_looper-0.1.0-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on infraguys/gcl_looper
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gcl_looper-0.1.0-py3-none-any.whl -
Subject digest:
11d62789cca9df02aaba456382af61ea89fd11a08a7cf5202e1678f5d8e6f448 - Sigstore transparency entry: 171819959
- Sigstore integration time:
-
Permalink:
infraguys/gcl_looper@18ce5e1417d14c2e936c5daac63f02084fd53604 -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/infraguys
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@18ce5e1417d14c2e936c5daac63f02084fd53604 -
Trigger Event:
push
-
Statement type: