Skip to main content

Async CSV performance logging

Project description

Async CSV Logger

PyPI

This module is a async csv logger that helps you log performance of your algorithm.

Description

This module is intented to be a csv logger which will write to file async-ly.

With the hope to have minimum performance impact on benchmarking your algorithm (i.e. I/O blocking to write to disk), this is especially useful for logging performance at each iteration/time-step. Internally, it utilise threading to async write to file.

There are two way to initialise and use the logger.

Install

pip install asynccsv

1. Recommended way (with block)

from asynccsv import AsyncCSVLogger

with AsyncCSVLogger('path_of_your_log.csv') as logger:
    # csv titles
    logger.write(['Time', 'Accuracy', 'Num of nodes'])

    # do your other stuff
    # ......

    import datetime
    for i in range(10):
        # perform calculation
        # ....
        # write results to file
        logger.write([datetime.datetime.now(), acc, num_nodes])

2. The normal way

from asynccsv import AsyncCSVLogger

class MyAwesomeAlgorithm():

    def __init__(self):
        # with the 'log_timestamp' flag it will automatically log timestamp
        self.logger = AsyncCSVLogger('path_of_your_log.csv', log_timestamp=True)

    def run(self):
        # perform calculation
        # ...
        logger.write([acc, num_nodes])


if __name__ == '__main__':
    awesome = MyAwesomeAlgorithm()
    for i in range(10):
        awesome.run()

    # You SHOULD run this to properly close the threading and force
    # everything to be written to disk
    # This is automatically done by the 'with' block in previous example
    awesome.logger.close()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

asynccsv-1.0.1.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

asynccsv-1.0.1-py3-none-any.whl (1.9 kB view details)

Uploaded Python 3

File details

Details for the file asynccsv-1.0.1.tar.gz.

File metadata

  • Download URL: asynccsv-1.0.1.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.5

File hashes

Hashes for asynccsv-1.0.1.tar.gz
Algorithm Hash digest
SHA256 c164cf0f7f8946d33d6aba092b67d96fd4a58716b207baceb84b1871b8352af8
MD5 f51d5e5dbfc7a236550f3516405bd54f
BLAKE2b-256 d6d6b247cf28c2cf825a675cd0d696eb30247b98f84563561fdf28d9ef2f0ca8

See more details on using hashes here.

File details

Details for the file asynccsv-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: asynccsv-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 1.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.5

File hashes

Hashes for asynccsv-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a15d97b63a483f5e8437cf2a3559e6e5bf63469416b2d5bae5b70289d4a5a73e
MD5 60a9e59564686a11485afa683a8d6c8e
BLAKE2b-256 883942bdc05a68c10d8da77ccf8c351c208782f46b714b0261364653c2624d33

See more details on using hashes here.

Supported by

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