Skip to main content

SoonQ

A subprocess-based task queue.

Introduction

SoonQ implements a simple FIFO queue using SQLite. It was created primarily for running long simulations.

As of yet, the vision of a subprocess-based workflow has not been realized. However, the package still works as a task queue.

Installation

pip install soonq

Usage

Users must create their own subclass of soonq.BaseTask. Subclasses must define a run() method, which contains the business logic for the task (what we care about). At least for now, input arguments to this method are restricted to being JSON serializable.

Running the examples

Example files are included in the examples directory. Clone SoonQ in your desired location...

C:\desired\location>git clone https://github.com/n8jhj/SoonQ.git

...and then navigate into the SoonQ directory and install it. Be careful to include the dot!

pip install .

Now run the following in two separate terminals:

Terminal 1:

Run the same script a couple times.

C:\...\SoonQ>python -m examples timer_task
Queued task: 913d56e9-a609-4b84-b937-479a94716527

C:\...\SoonQ>python -m examples timer_task
Queued task: da952424-98d9-42e1-8851-91a30924b94b

C:\...\SoonQ>

Terminal 2:

C:\...\SoonQ>python -m examples timer_worker
Running task: 913d56e9-a609-4b84-b937-479a94716527
1/3 Sleeping 3 seconds...
2/3 Sleeping 3 seconds...
3/3 Sleeping 3 seconds...
Slept 9 seconds total.
Finished task: 913d56e9-a609-4b84-b937-479a94716527

Running task: da952424-98d9-42e1-8851-91a30924b94b
1/3 Sleeping 3 seconds...
2/3 Sleeping 3 seconds...
3/3 Sleeping 3 seconds...
Slept 9 seconds total.
Finished task: da952424-98d9-42e1-8851-91a30924b94b

Waiting for next task... (Ctrl + C to quit)

With the worker running, more tasks can be enqueued and will be immediately processed.

Press Ctrl + C to quit the worker.

Quitting

C:\...\SoonQ>

Etymology

This project is named after my friend Soon-Kyoo, with whom I enjoyed countless bouts of epic ping-pong in college. People call him Q, for short.

Metadata

Release files for soonq 0.2.0

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

Source distribution (sdist)

Source distribution for soonq 0.2.0
File Size Uploaded
SoonQ-0.2.0.tar.gz 8.3 kB Details

Built distribution (wheel)

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

Total release size: 17.0 kB

Release files / SoonQ-0.2.0.tar.gz

Download URL SoonQ-0.2.0.tar.gz
Size 8.3 kB
Tags Source
SHA-256 checksum
How to use checksums
85d469277a413b3def03a589b683a6099bd286d5ebe79763a27a009174e2988f
BLAKE2b-256 checksum
How to use checksums
d8ad3b9f8bc9f10a8dfcac3d9906bda66b4164e5cc35cc6cd574cc5848590b1a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.10 CPython/3.8.2 Windows/10

Release files / SoonQ-0.2.0-py3-none-any.whl

Download URL SoonQ-0.2.0-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a9d57676b2aec765c581e85f7d22ef02e8e5499f4dbdfdf076c20a76bca53ae3
BLAKE2b-256 checksum
How to use checksums
d73711fafbb2fb640f85835bf41282cc70f4a0b07af53da302497ca838f76750
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.10 CPython/3.8.2 Windows/10

Release history Release notifications | RSS feed

0.4.1

2 release files

0.3.1

2 release files

0.3.0

2 release files

This release

0.2.0 This release

2 release files

0.1.0

2 release files

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