process_decorator
If you write async code, you now that all code work on one processor (tnx GIL), but we can resolve this problem with execution code in other process.
ATTENTION, we get profit only if function work more than 0.1 sec or if you need make async function. AND don't work global variable, because func work in other process
from process_decorator import async_process
import asyncio
@async_process()
def test():
return 2*500000000
if __name__ == '__main__':
asyncio.run(test())
this code creates other process where will be executed.
async_process get argument exit_process_timer, witch cache process on time executed. If you call this function every time, this parameter will up speed of execution
from process_decorator import async_process
import asyncio
@async_process(exit_process_timer=10)
def test():
return 2*50000000
if __name__ == '__main__':
for _ in range(30):
asyncio.run(test())
where:
exit_process_timer - is time in second when process close if wont call
Metadata
Release files for process-decorator 0.7.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| process_decorator-0.7.1.tar.gz | 5.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| process_decorator-0.7.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.4 kB
Release files / process_decorator-0.7.1.tar.gz
| Download URL | process_decorator-0.7.1.tar.gz |
|---|---|
| Size | 5.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
67f17c5308b2142ae5539d0cded49992d0b8ba89d6e5127cac879a7483ef4939
|
|
BLAKE2b-256 checksum How to use checksums |
0e58e86b4b98fa20f266f10f6c1dd71d8587859ce32422ad0d9b417f1c38e5cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.5
|
Release files / process_decorator-0.7.1-py3-none-any.whl
| Download URL | process_decorator-0.7.1-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1867edcb95a1aac310c19677a3db149a049ad97ca0b68db7d72e5ff307a0d61b
|
|
BLAKE2b-256 checksum How to use checksums |
f9f80ca1d542963f5374fbd5531c17b94af6b36ec124bb1c9eb78fbb4760f954
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.5
|