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
File details
Details for the file simple_background_task-0.1.1.tar.gz
.
File metadata
- Download URL: simple_background_task-0.1.1.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0598a52609dec0fd51821a8eaacda5aa16fcb866bd9e2a12a1874cc8adeb9f4f |
|
MD5 | 4766f4dd436aaeb92723f7f0fd7647b8 |
|
BLAKE2b-256 | eca117c8ed325c9b3edf313df7ae6aa10bfb887cc43762ea45bea987235c5d8f |
File details
Details for the file simple_background_task-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: simple_background_task-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2379be76f2636b8b74794ac923c359df01d18b8c3856be65a18678f453213604 |
|
MD5 | c66111cc289cce7042cdfdfb78aaeb9a |
|
BLAKE2b-256 | 33180e586b332e71ed898f3e23fe68794fa4495812367d98a2b2d09b1cf15027 |