Skip to main content

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

  1. 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"}
    }
)
  1. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

simple_background_task-0.1.1.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

simple_background_task-0.1.1-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

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

Hashes for simple_background_task-0.1.1.tar.gz
Algorithm Hash digest
SHA256 0598a52609dec0fd51821a8eaacda5aa16fcb866bd9e2a12a1874cc8adeb9f4f
MD5 4766f4dd436aaeb92723f7f0fd7647b8
BLAKE2b-256 eca117c8ed325c9b3edf313df7ae6aa10bfb887cc43762ea45bea987235c5d8f

See more details on using hashes here.

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

Hashes for simple_background_task-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2379be76f2636b8b74794ac923c359df01d18b8c3856be65a18678f453213604
MD5 c66111cc289cce7042cdfdfb78aaeb9a
BLAKE2b-256 33180e586b332e71ed898f3e23fe68794fa4495812367d98a2b2d09b1cf15027

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page