A lightweight folder-based job queue system
Project description
QueueDir
A lightweight, cross-platform folder-based job queue system. Monitors an input folder and executes a script for each file that appears.
Installation
pip install queuedir
Usage
queuedir --watch /path/to/inbox --script /path/to/process.sh
Options
| Option | Short | Description | Default |
|---|---|---|---|
--watch |
-w |
Folder to monitor (required) | - |
--script |
-s |
Script to execute (required) | - |
--done-dir |
Destination for processed files | {watch}/done |
|
--failed-dir |
Destination for failed files | {watch}/failed |
|
--timeout |
Script timeout in seconds | 1200 | |
--poll-interval |
File stability check interval | 2 | |
--venv |
Path to virtual environment to activate | - | |
--once |
Process existing files and exit | - | |
--verbose |
-v |
Enable debug logging | - |
Example
# Monitor inbox, run process.py for each file
queuedir -w ./inbox -s ./process.py -v
# Use a virtual environment for Python scripts
queuedir -w ./inbox -s ./process.py --venv /path/to/venv
# Process existing files once and exit
queuedir -w ./inbox -s ./process.sh --once
How It Works
- Files dropped into the watched folder are detected
- QueueDir waits for the file to stabilize (no longer being written)
- The configured script is executed with the file path as argument
- On success (exit 0): file moves to
done/ - On failure (non-zero exit): file moves to
failed/
Virtual Environment Support
When you specify a virtual environment with --venv, QueueDir will:
- Set the
VIRTUAL_ENVenvironment variable - Add the venv's bin/Scripts directory to
PATH - Use the venv's Python interpreter for
.pyscripts - Make all venv packages available to your scripts
You can also set the venv via the QUEUEDIR_VENV environment variable:
export QUEUEDIR_VENV=/path/to/venv
queuedir -w ./inbox -s ./process.py
Script Requirements
Your script receives the file path as the first argument:
#!/bin/bash
filepath="$1"
echo "Processing: $filepath"
# ... do work ...
exit 0 # success
#!/usr/bin/env python
import sys
filepath = sys.argv[1]
print(f"Processing: {filepath}")
# ... do work ...
sys.exit(0) # success
License
MIT
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 queuedir-1.1.0.tar.gz.
File metadata
- Download URL: queuedir-1.1.0.tar.gz
- Upload date:
- Size: 10.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
11da2ae48d2606f0cb0dc08ae12e2a71efbdc207755123708cd6da3080abce84
|
|
| MD5 |
3ca82c681115aaa3286b9392a52b7601
|
|
| BLAKE2b-256 |
3032279e1fb623d2054a864f760ccfc7d7bca48d81980866c12680ab9dfee125
|
File details
Details for the file queuedir-1.1.0-py3-none-any.whl.
File metadata
- Download URL: queuedir-1.1.0-py3-none-any.whl
- Upload date:
- Size: 9.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85c40b0730e0138406676292935a93b57e6f2ba844d7ce1e6b492b51636bb0a6
|
|
| MD5 |
6f193aa69db9ea49ed048546bccaa628
|
|
| BLAKE2b-256 |
f6bc8f11bb3d2eed45dbcce1db0bc24b22eb088590eadc683ae888a1983ce4a8
|