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.1.6.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.1.6-py3-none-any.whl (4.8 MB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for sparrow_python-0.1.6.tar.gz
Algorithm Hash digest
SHA256 1b4235ee40928c602e33d45ea1c7c1e8e6cb517adaae344a30369276f1406e2f
MD5 cadfa257cfb0a252ae72f6ec06a16739
BLAKE2b-256 88674cbd57b828a27608d8d1b8cf763a3e0fe57ca946a0236814285805d357b0

See more details on using hashes here.

File details

Details for the file sparrow_python-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: sparrow_python-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 4.8 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.17

File hashes

Hashes for sparrow_python-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 214fedc34dedd3f3c5655e2fc73074f630c6f3664d4d819c3e8d8e9ff6692cd1
MD5 6a41dc976973b85c814e843556af90e2
BLAKE2b-256 522dcb854a918ed99ef8351f4b8bb175bf1f05ee96196da88a04b703ce818f72

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