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

This will start service at address 0.0.0.0:50001.

(Process1) productor:

from sparrow.multiprocess.client import Client
client = Client()
client.update_data({'a': 1, 'b': 2})

(Process2) consumer:

from sparrow.multiprocess.client import Client
client = Client()
print(client.get_data())

>>> {'a': 1, 'b': 2}

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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for sparrow-tool-0.6.0.tar.gz
Algorithm Hash digest
SHA256 1303d7b9e5248bc28dc8a36bef02d12587d14d7ef0a2e56f020c87666ff8247f
MD5 c0b9fec1da97e801deac0d9587ed9cc6
BLAKE2b-256 7a28192abb4b433954afa245b2e361ce09fc2ec33175fbf95af69010f84222ef

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sparrow_tool-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cd31a7cb24bfd7e24a64d10c1d44aed989b88ee3220120ee7878bfab53ab357e
MD5 987d25511c3e6d5ac3213e033193b097
BLAKE2b-256 529925395cba60b539d1c9a368eb34a2a8eda69c465fa3e3da944c99be204c1f

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