{"id":17632712,"url":"https://github.com/kentakoong/mtnlog","last_synced_at":"2026-01-11T02:42:13.908Z","repository":{"id":250720181,"uuid":"835361133","full_name":"Kentakoong/mtnlog","owner":"Kentakoong","description":"A simple multinode performance logger for Python","archived":false,"fork":false,"pushed_at":"2024-09-24T07:21:57.000Z","size":88,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-10T04:04:44.082Z","etag":null,"topics":["cuda","lanta","nvitop","python","slurm-cluster"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Kentakoong.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-29T17:14:36.000Z","updated_at":"2024-09-24T07:22:01.000Z","dependencies_parsed_at":"2024-10-23T10:17:52.301Z","dependency_job_id":null,"html_url":"https://github.com/Kentakoong/mtnlog","commit_stats":null,"previous_names":["kentakoong/mtnlog","kentakoong/perflogger"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kentakoong%2Fmtnlog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kentakoong%2Fmtnlog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kentakoong%2Fmtnlog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kentakoong%2Fmtnlog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kentakoong","download_url":"https://codeload.github.com/Kentakoong/mtnlog/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235048982,"owners_count":18927715,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cuda","lanta","nvitop","python","slurm-cluster"],"created_at":"2024-10-23T01:45:15.559Z","updated_at":"2025-10-02T23:34:55.226Z","avatar_url":"https://github.com/Kentakoong.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mtnlog - A simple multinode performance logger for Python\n\n## Introduction\n\nmtnlog is a simple multinode performance logger for Python. It is designed to be used in a similar way to Python's built-in logging module, but with a focus on performance logging. It provides a simple API for logging performance data, including start and end times, and allows for easy integration with other logging systems.\n\n## Installation\n\nYou can install mtnlog using pip:\n\n```bash\npip install mtnlog\n```\n\n## Usage\n\nTo use mtnlog, you have two features: `JSONLogger` and `PerformanceLogger` and `PerformancePlotter`.\n\n### JSONLogger\n\nThe `JSONLogger` class is a simple logger that writes performance data to a JSON file. You can create a new `JSONLogger` instance by passing a file path to the constructor:\n\n```python\nfrom mtnlog import JSONLogger\n\nlogger = JSONLogger(log_dir='logs') # logs is the directory where the log file will be saved\n```\n\nYou can then use the `log` method to log performance data:\n\n```python\nlogger.log('\u003cyour_dict\u003e', filename='log') # your_dict is a dictionary with the data you want to log / filename is the name of the file\n```\n\n`your_dict` is a dictionary with the data you want to log.\n`filename` is the name of the file where the data will be saved\n\n### PerformanceLogger\n\nThe `PerformanceLogger` class is a logger for system performance data. It logs the the time taken to execute the block, as well as the CPU, memory, and GPU usage. You can create a new `PerformanceLogger` instance by passing a file path to the constructor:\n\n```python\nfrom mtnlog import PerformanceLogger\n\ncollector = PerformanceLogger(log_dir=\"\u003cyour_log_dir\u003e\", log_node=\"\u003ccurrent_node\u003e\")\n```\n\n`your_log_dir` is the directory where the log file will be saved.\n`current_node` is the number of the node you are logging.\n\nYou can then use the `change_tag` method to change the tag of the log:\n\n```python\ncollector.change_tag(\"\u003cnew_tag\u003e\")\n```\n\n`new_tag` is the new tag you want to use.\n\nTo stop logging, you can use the `stop` method:\n\n```python\ncollector.stop()\n```\n\n### PerformancePlotter\n\nThe `PerformancePlotter` class is a plotter for system performance data. It plots the time taken to execute the block, as well as the CPU, memory, GPU, and network usage. You can create a new `PerformancePlotter` instance by passing a file path to the constructor:\n\n```python\nfrom mtnlog import PerformancePlotter\n\nplotter = PerformancePlotter(base_dir=\"\u003cyour_base_dir\u003e\", log_node=\"\u003ccurrent_node\u003e\")\n\n```\n\n`your_base_dir` is the base directory where the log file will be saved.\n`current_node` is the number of the node you are logging.\n\nYou can then use the `plot` method to plot the data:\n\n```python\n\nplotter.plot()\n\n```\n\n## Example\n\nHere is an example of how to use mtnlog:\n\n```python\nfrom mtnlog import JSONLogger, PerformanceLogger, PerformancePlotter\n\n# Create a JSONLogger instance\n\nlogger = JSONLogger(log_dir='logs')\n\n# Log some data\n\nlogger.log({'message': 'Hello, world!'}, filename='log')\n\n# Create a PerformanceLogger instance\n\ncollector = PerformanceLogger(log_dir='logs', log_node=\"0\")\n\n# Change the tag\n\ncollector.change_tag('new_tag')\n\n# Stop logging\n\ncollector.stop()\n\n# Create a PerformancePlotter instance\n\nplotter = PerformancePlotter(base_dir='logs', log_node=\"0\")\n\n# Plot the data\n\nplotter.plot()\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkentakoong%2Fmtnlog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkentakoong%2Fmtnlog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkentakoong%2Fmtnlog/lists"}