No project description provided
Project description
sparrow-python
Install
pip install sparrow-python
# Or dev version
pip install sparrow-python[dev]
# Or
pip install -e .
# Or
pip install -e .[dev]
Usage
Multiprocessing SyncManager
Open server first:
$ spr start-server
The defualt port 50001.
(Process1) productor:
from sparrow.multiprocess.client import Client
client = Client(port=50001)
client.update_dict({'a': 1, 'b': 2})
(Process2) consumer:
from sparrow.multiprocess.client import Client
client = Client(port=50001)
print(client.get_dict_data())
>> > {'a': 1, 'b': 2}
Common tools
- Kill process by port
$ spr kill {port}
- pack & unpack
support archive format: "zip", "tar", "gztar", "bztar", or "xztar".
$ spr pack pack_dir
$ spr unpack filename extract_dir
- Scaffold
$ spr create awosome-project
Some useful functions
sparrow.relp
Relative path, which is used to read or save files more easily.
sparrow.performance.MeasureTime
For measuring time (including gpu time)
sparrow.performance.get_process_memory
Get the memory size occupied by the process
sparrow.performance.get_virtual_memory
Get virtual machine memory information
sparrow.add_env_path
Add python environment variable (use relative file path)
Safe logger in multiprocessing
from sparrow.log import Logger
import numpy as np
logger = Logger(name='train-log', log_dir='./logs', )
logger.info("hello", "numpy:", np.arange(10))
logger2 = Logger.get_logger('train-log')
print(id(logger2) == id(logger))
>> > True
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sparrow_python-0.1.1.tar.gz.
File metadata
- Download URL: sparrow_python-0.1.1.tar.gz
- Upload date:
- Size: 4.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bcaef6f08a09e1738aca4ae1c12306fd08269de5c6e8b00dddfaea9edd0b118c
|
|
| MD5 |
bca82ff08e0a41f1cf3e330429f5a506
|
|
| BLAKE2b-256 |
4b92d41d11bdce31993b274f0f54bca71e3480c898e9c83157a5bee795c459b0
|
File details
Details for the file sparrow_python-0.1.1-py3-none-any.whl.
File metadata
- Download URL: sparrow_python-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.8 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4143c59690b4f88a0a6defaa8406ba6edf3fc9f3db86174374e4dd315588559a
|
|
| MD5 |
c95b2882b803ee88f1855ed87beceaef
|
|
| BLAKE2b-256 |
bb4a705229f49941a46981375afeea56c1828a77b284794169832306eb92a663
|