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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

sparrow_tool-0.6.2-py3-none-any.whl (17.3 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sparrow_tool-0.6.2-py3-none-any.whl
  • Upload date:
  • Size: 17.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12

File hashes

Hashes for sparrow_tool-0.6.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8434fda789e3ff3de036f441aa388ef1ffd408fcf35934335fe84d2a0d8a84a1
MD5 bbdb0d0f14a7ab2fc67c3212bd39e9b9
BLAKE2b-256 67abd9d03cd909c4b41bd3ca93cefc5fd36130e1afe77f321bb49ad1e655b392

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