Postgres-based distributed task processing library
Project description
Procrastinate is an open-source Python 3.6+ distributed task processing library, leveraging PostgreSQL to store task definitions, manage locks and dispatch tasks.
In other words, from your main code, you call specific functions (tasks) in a special way and instead of being run on the spot, they’re scheduled to be run elsewhere, now or in the future.
Here’s an example
# mycode.py
# Make a app in your code
app = procrastinate.App(job_store=procrastinate.PostgresJobStore())
# Then define tasks
@app.task(queue="sums")
def sum(a, b):
with open("myfile", "w") as f:
f.write(str(a + b))
# Launch a job
sum.defer(a=3, b=5)
# Somewhere in your program, run a worker
worker = procrastinate.Worker(
app=app,
queues=["sums"]
)
worker.run()
The worker will run the job, which will create a text file named myfile with the result of the sum 3 + 5 (that’s 8).
Similarly, from the command line:
export PROCRASTINATE_APP="mycode.app"
# Launch a job
procrastinate defer mycode.sum '{"a": 3, "b": 5}'
# Run a worker
procrastinate worker sums
There are quite a few interesting features that Procrastinate adds to the mix. You can head to the Quickstart section for a general tour or to the How-To sections for specific features. The Discussion section should hopefully answer your questions. Otherwise, feel free to open an issue.
The project is still quite early-stage and will probably evolve.
Note to my future self: add a quick note here on why this project is named “Procrastinate”.
Where to go from here
The complete docs is probably the best place to learn about the project.
If you encounter a bug, or want to get in touch, you’re always welcome to open a ticket.
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
File details
Details for the file procrastinate-0.2.1.tar.gz
.
File metadata
- Download URL: procrastinate-0.2.1.tar.gz
- Upload date:
- Size: 23.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1d8ecd109ef570ff639bcd1e5cd99162d7b4d4f721eacaa7a8094a626f8f66e |
|
MD5 | 2a24b0fc69fdd9d3663aa59fc12fec08 |
|
BLAKE2b-256 | d16ec298a186224206a1689d190201c396871e6d1ecae4a3031ae09c6cac709d |
File details
Details for the file procrastinate-0.2.1-py3-none-any.whl
.
File metadata
- Download URL: procrastinate-0.2.1-py3-none-any.whl
- Upload date:
- Size: 30.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b98c807a6ed0b530f1358cdaac8d97f4e29ea0e0745824904388d3498eeb2c15 |
|
MD5 | 97ba20b2fdaa29155ca006bf6cc55fac |
|
BLAKE2b-256 | 4c3662e37446bec6312d5b90953f1e6e9e755d6ea94bc15b66a8f1babbb14b4e |