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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

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