Skip to main content

Python Common Function Tool Set.

Project description

sparrow_tool

image image image image


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.7.3.tar.gz (10.4 MB view details)

Uploaded Source

Built Distribution

sparrow_tool-0.7.3-py3-none-any.whl (9.6 MB view details)

Uploaded Python 3

File details

Details for the file sparrow-tool-0.7.3.tar.gz.

File metadata

  • Download URL: sparrow-tool-0.7.3.tar.gz
  • Upload date:
  • Size: 10.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.14

File hashes

Hashes for sparrow-tool-0.7.3.tar.gz
Algorithm Hash digest
SHA256 fbf78c1924a2201dc5326f656304bf813e74eaa91f70f3960c57b66bc55724d1
MD5 67964b1c52453a29c0fc0ef6b4db87c9
BLAKE2b-256 ae041e1a8f2914a523e8766fd74c095e63865b33b76cd304de975e51a00f6914

See more details on using hashes here.

File details

Details for the file sparrow_tool-0.7.3-py3-none-any.whl.

File metadata

File hashes

Hashes for sparrow_tool-0.7.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a0cda4d58df1d2a4d3c0acfa692430a7be6ed5cae3c085cf8dc449fa80c47252
MD5 20bea6a86e3d34f74b5afc8ae2b5bb0e
BLAKE2b-256 453748915be0b2fa9ae96cf13a091479d9bcea1223a4bafc46cf2783864e68e4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page