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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: sparrow-tool-0.7.2.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.2.tar.gz
Algorithm Hash digest
SHA256 58aaf3feb68cfb81de4957cac28d01175b7e27ee30efe082cf648e83dc88efac
MD5 7e53529b7d8c13f05859765cf0abb59a
BLAKE2b-256 8a366fde2bc22ae0d14b48c0d44475f4860e7ca15710bdd4e087d5b1db70d455

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sparrow_tool-0.7.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a7ac634cf0d3c690c3585eba91aa60960f6f32f658a5d414ef99f3ed2a6fa523
MD5 69dcdcdeee9e6568dd76146fd8abd8ee
BLAKE2b-256 639140ab10618d3667b6cd1ec8d1a46d4aa81f4fe815afee8992b60c4cacf012

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