No project description provided
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
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
$ sparrow kill {port}
-
pack & unpack
support archive format: "zip", "tar", "gztar", "bztar", or "xztar".sparrow pack pack_dir sparrow unpack filename extract_dir
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.8.0.tar.gz
(4.7 MB
view details)
Built Distribution
File details
Details for the file sparrow_tool-0.8.0.tar.gz
.
File metadata
- Download URL: sparrow_tool-0.8.0.tar.gz
- Upload date:
- Size: 4.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.14
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5eacc41fefcd64a6155d13deb8ddfc078ab39330def4bba146252dd33b99640c |
|
MD5 | 3b7673448f2e97fb5ba960d2865e2980 |
|
BLAKE2b-256 | e3582e70f23e4c9b7766699094ee748fba8a931c47c322f0c446fd5ca7b181d7 |
File details
Details for the file sparrow_tool-0.8.0-py3-none-any.whl
.
File metadata
- Download URL: sparrow_tool-0.8.0-py3-none-any.whl
- Upload date:
- Size: 4.8 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.14
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c90ae5c27251936b9392d6c4235bbb45884acc5719d6148e27bbfd6375e0ad1f |
|
MD5 | 3d4f762b8d6a3de6338b39e3495c4a9a |
|
BLAKE2b-256 | ca94a98ba38519db208262e8a5db08a6b0e8685393a1aa62210c2bd8a7e3111f |