Python Common Function Tool Set.
Project description
sparrow_tool
Install
pip install sparrow-tool
# Or dev version
pip install sparrow-tool[dev]
# Or
pip install -e .
# Or
pip install -e .[dev]
Usage
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
Multiprocessing SyncManager
Open server first:
$ sparrow start-server
This will start service at address 0.0.0.0:50001
.
(Process1) productor:
from sparrow.multiprocess.client import Client
client = Client()
client.update_data({'a': 1, 'b': 2})
(Process2) consumer:
from sparrow.multiprocess.client import Client
client = Client()
print(client.get_data())
>>> {'a': 1, 'b': 2}
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
sparrow-tool-0.6.4.tar.gz
(4.7 MB
view hashes)
Built Distribution
Close
Hashes for sparrow_tool-0.6.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef3559dc7ad82e2a37cc053239cb05b13defb769325d2c6f53fd205052f16d64 |
|
MD5 | f661387b51e7609c368313608afd3771 |
|
BLAKE2b-256 | 0ca0a2ac592827923d3eb8effd9641d797ba9e7df4a90d802969ce717abfe5f9 |