Skip to main content

Library to queue actions.

Project description

python3-cyberfusion-queue-support

Library to queue actions.

Concepts

All project-specific terms are in italic.

After creating a queue, items can be added to it.

queue = Queue()

queue.add(item)

These items can be of multiple types such as ChmodItem or SystemdUnitRestartItem, and they can have attributes such as a path for an MkdirItem or a unit name for a SystemdUnitEnableItem.

item1 = ChmodItem(path="/tmp/example.txt", mode=0o600)
item2 = SystemdUnitEnableItem(name="httpd.service")

Each item type has one or multiple outcomes that should come true for an item of that type to be completed. For example: for an item of type UnlinkItem, the outcome is that the file at the path given with the item is unlinked.

When a queue is processed, all the items added to it are fulfilled, meaning all the items' outcomes are completed.

item = RmTreeItem(path="/tmp/dir")

queue = Queue()

queue.add(item)

# for each item added to the queue, its fulfill() function is run
queue.process()

# this would do the same
item.fulfill()

Install

PyPI

Run the following command to install the package from PyPI:

pip3 install python3-cyberfusion-queue-support

Debian

Run the following commands to build a Debian package:

mk-build-deps -i -t 'apt -o Debug::pkgProblemResolver=yes --no-install-recommends -y'
dpkg-buildpackage -us -uc

Configure

No configuration is supported.

Usage

Example

from cyberfusion.QueueSupport import Queue
from cyberfusion.QueueSupport.items.chmod import ChmodItem

queue = Queue()

item = ChmodItem(path="/tmp/example.txt", mode=0o600)
print(item.outcomes)

queue.add(item)

preview = True or False

outcomes = queue.process(preview=preview)

for outcome in outcomes:
    print(str(outcome))

Project details


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

File details

Details for the file python3_cyberfusion_queue_support-1.2.tar.gz.

File metadata

File hashes

Hashes for python3_cyberfusion_queue_support-1.2.tar.gz
Algorithm Hash digest
SHA256 91ae32e2b0433f11f3a3c21fadd98ec6f2bd89eef9e8b816816954cf11b6e605
MD5 0ab04d3197c70bb9c37083f0a9bef75a
BLAKE2b-256 91c3e1aba1ea012c5f78fdc6cdc7098afe2ca62334a26b0040ebdc68f3739d5c

See more details on using hashes here.

File details

Details for the file python3_cyberfusion_queue_support-1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for python3_cyberfusion_queue_support-1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e6c33f3453166989383f93e43beb942a1370adc5c6fc1c0a3baf5db6acc4d973
MD5 bc623d4b99202c2d9896065ebe307771
BLAKE2b-256 1d66b3a1fd38426a2bd1026befe0a2bc6cdac1e76d63d87359cbcc29e77c5ace

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