A background task base on thread,easy to integer with any framework
Project description
simple_background_task
Features
- execute background task,with thread
- support multiple queue,eg memory/rocketmq(todo)
- easy to integrate with frameworks
Install
pip install simple_background_task
Usage
- in script
# start main process
from simple_background_task import BackgroundTask
BackgroundTask().start()
# start a background task
from simple_background_task import defer
def test_job():
pass
defer(
func=test_job,
arguments={
"args": [1, 2],
"kwargs": {"a": "b"}
}
)
- in django
# settings.py
INSTALLED_APPS = [
...
'simple_background_task.integrate.django',
]
# start a background task
from simple_background_task import defer
def test_job():
pass
defer(
func=test_job,
arguments={
"args": [1, 2],
"kwargs": {"a": "b"}
}
)
Test
python -m pytest tests
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
Close
Hashes for simple_background_task-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0598a52609dec0fd51821a8eaacda5aa16fcb866bd9e2a12a1874cc8adeb9f4f |
|
MD5 | 4766f4dd436aaeb92723f7f0fd7647b8 |
|
BLAKE2b-256 | eca117c8ed325c9b3edf313df7ae6aa10bfb887cc43762ea45bea987235c5d8f |
Close
Hashes for simple_background_task-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2379be76f2636b8b74794ac923c359df01d18b8c3856be65a18678f453213604 |
|
MD5 | c66111cc289cce7042cdfdfb78aaeb9a |
|
BLAKE2b-256 | 33180e586b332e71ed898f3e23fe68794fa4495812367d98a2b2d09b1cf15027 |