Skip to main content

# Background2 : run stuff in the backround
---
this is a fork from [kennethreitz/background](https://github.com/kennethreitz/background.git)

The main purpose is add multi instance to background

```
import background2
import time

bg1 = background2.Background()

bg2 = background2.Background()

@bg1.task
def work1(param1,param2):
print('task1:work1')
time.sleep(3)
return 'task1:work1:{}-{}'.format(param1,param2)

@bg2.task
def work2():
print('task2:work2')
time.sleep(3)
return 'task2:work2'

@bg1.callback
def back1(future):
print('back1 for task1')


@bg2.callback
def back2(future):
print('back2 for task2')

def test_background():
work1('1','2')
work2()

def common():
print('common function')

if __name__ == '__main__':
test_background()
common()
```
### install
```pip install background2```
or
clone the project and ``` python setup.py install ```

---
suggestion and pull request are welcome




LICENSE:MIT

Metadata

Release files for background2 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for background2 0.1.1
File Size Uploaded
background2-0.1.1.tar.gz 3.1 kB Details

Release files / background2-0.1.1.tar.gz

Download URL background2-0.1.1.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
1ebc16aa3e541ee0034f13c3712ae79119c984dc76ba2a8368675fc884bdbe02
BLAKE2b-256 checksum
How to use checksums
5e56d7d23d767adbd7e105ec3e4c400d6b0b4f53e2cef18f3c1dbb5b1e00be91
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/3.6

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page