Skip to main content

No project description provided

Project description

sparrow-python

image image image image


Install

pip install sparrow-python
# Or dev version
pip install sparrow-python[dev]
# Or
pip install -e .
# Or
pip install -e .[dev]

Usage

Multiprocessing SyncManager

Open server first:

$ spr 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
$ spr kill {port}
  • pack & unpack
    support archive format: "zip", "tar", "gztar", "bztar", or "xztar".
$ spr pack pack_dir
$ spr unpack filename extract_dir
  • Scaffold
$ spr create awosome-project

Some useful functions

sparrow.relp
Relative path, which is used to read or save files more easily.

sparrow.performance.MeasureTime
For measuring time (including gpu time)

sparrow.performance.get_process_memory
Get the memory size occupied by the process

sparrow.performance.get_virtual_memory
Get virtual machine memory information

sparrow.add_env_path
Add python environment variable (use relative file path)

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

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

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sparrow_python-0.0.4-py2.py3-none-any.whl (4.8 MB view details)

Uploaded Python 2Python 3

File details

Details for the file sparrow_python-0.0.4.tar.gz.

File metadata

  • Download URL: sparrow_python-0.0.4.tar.gz
  • Upload date:
  • Size: 4.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.16

File hashes

Hashes for sparrow_python-0.0.4.tar.gz
Algorithm Hash digest
SHA256 25af85aad3f252d8338b04391cb9c33d61384257cfe2358422ed9573bda3b24b
MD5 773481fbbad58153138e20811f1a057b
BLAKE2b-256 766a354ac5cd55d892e917df270d53f05d6c206859938d0b49cb0e9b954746c4

See more details on using hashes here.

File details

Details for the file sparrow_python-0.0.4-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for sparrow_python-0.0.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 4ff728e750c7d13541f29db81f280b31a95370ce69a0eadc67fccfa41a5469a2
MD5 c553b8726101aae67ff1b461177aacae
BLAKE2b-256 68558e78164ab0342714e8f0d69cbf0067e0e981b7645a448f8f8454866ac233

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page