Skip to main content

No project description provided

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

Uploaded Source

Built Distribution

sparrow_tool-0.7.8-py3-none-any.whl (8.7 MB view details)

Uploaded Python 3

File details

Details for the file sparrow_tool-0.7.8.tar.gz.

File metadata

  • Download URL: sparrow_tool-0.7.8.tar.gz
  • Upload date:
  • Size: 8.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for sparrow_tool-0.7.8.tar.gz
Algorithm Hash digest
SHA256 fd42c1087fcca1c9b04aca35a2e21554b9835c7246f30b6d5b705c20fd8bd5c9
MD5 55837c4d36976d5a9834260dd7d0c2a7
BLAKE2b-256 78dc6b1f0852cf319e112a7ad58fdff24d32400867bc0339e07c958023aed723

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sparrow_tool-0.7.8-py3-none-any.whl
Algorithm Hash digest
SHA256 ff8a75aab80599371c51b6b8b2410c2543bb9d43335f9824868a3932d9a6a845
MD5 7b2ee7fc4bfe6540f661218ebb694e58
BLAKE2b-256 422fa5cb001ccc56a9e1c36dd238c0822ce91ea5ba3ee7d5388e1f133fc52b04

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