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

Uploaded Source

Built Distribution

sparrow_tool-0.7.0-py3-none-any.whl (9.5 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sparrow-tool-0.7.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

Hashes for sparrow-tool-0.7.0.tar.gz
Algorithm Hash digest
SHA256 f179d32956d5358775bf582a4bbd98bee97722dfa768608ef9ab1d7faac00bd5
MD5 2ab7c895ab9ac84ba745162ac3bd77b4
BLAKE2b-256 39df93e1d1eaad46a4ef64bebfa9fc92f82ebcb64344f252f6534a840009d087

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sparrow_tool-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 39601492ee93800a39de743a2ebb291e7ece4d5ea8e099efaca1ed1771823cec
MD5 07a75a6697128e2bb502b7ff9b03e2d2
BLAKE2b-256 bc5f0fb221b4b235e61554ef83037c33f1e70752511fe73fe04327248cf62fd2

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