# pipen-poplog
Populate logs from jobs to running log of the pipeline for [pipen][1].
## Installation
```bash
pip install -U pipen-poplog
```
## Enabling/Disabling the plugin
The plugin is registered via entrypoints. It's by default enabled. To disable it:
`plugins=[..., "no:log2file"]`, or uninstall this plugin.
## Usage
```python
from pipen import Proc, Pipen
class Poplog(Proc):
input = "var:var"
input_data = [0, 1, 2]
script = """
echo -n "[PIPEN-POPLOG][INFO] Log message "
sleep 1 # Simulate message not read in time
echo "by {{in.var}} 1"
sleep 1
echo "[PIPEN-POPLOG][ERROR] Log message by {{in.var}} 2"
sleep 1
echo "[PIPEN-POPLOG][INFO] Log message by {{in.var}} 3"
"""
if __name__ == "__main__":
Pipen().run()
```
```
01-12 11:23:52 I core ╭═══════════════ PoplogDefault ═════════════════╮
01-12 11:23:52 I core ║ A default poplog proc ║
01-12 11:23:52 I core ╰═══════════════════════════════════════════════╯
01-12 11:23:52 I core PoplogDefault: Workdir: '.pipen/Pipeline/PoplogDefault'
01-12 11:23:52 I core PoplogDefault: <<< [START]
01-12 11:23:52 I core PoplogDefault: >>> [END]
01-12 11:23:56 I poplog PoplogDefault: [0/2] Log message by 0 1
01-12 11:23:59 E poplog PoplogDefault: [0/2] Log message by 0 2
01-12 11:24:02 I poplog PoplogDefault: [0/2] Log message by 0 3
```
## Configuration
- `plugin_opts.poplog_loglevel`: The log level for poplog. Default: `info`.
- `plugin_opts.poplog_pattern`: The pattern to match the log message. Default: `r'\[PIPEN-POPLOG\]\[(?P<level>\w+)\] (?P<message>.*)'`.
- `plugin_opts.poplog_jobs`: The job indices to be populated. Default: `[0]` (the first job).
- `plugin_opts.poplog_max`: The total max number of the log message to be poplutated. Default: `99`.
- `plugin_opts.poplog_source`: The source of the log message. Default: `stdout`.
[1]: https://github.com/pwwang/pipen
Raw data
{
"_id": null,
"home_page": "https://github.com/pwwang/pipen-poplog",
"name": "pipen-poplog",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": null,
"author": "pwwang",
"author_email": "pwwang@pwwang.com",
"download_url": "https://files.pythonhosted.org/packages/29/ad/14fe41678f1f00549e5632b121460b03084ec992f2b965762d21c9032c65/pipen_poplog-0.2.0.tar.gz",
"platform": null,
"description": "# pipen-poplog\n\nPopulate logs from jobs to running log of the pipeline for [pipen][1].\n\n## Installation\n\n```bash\npip install -U pipen-poplog\n```\n\n## Enabling/Disabling the plugin\n\nThe plugin is registered via entrypoints. It's by default enabled. To disable it:\n`plugins=[..., \"no:log2file\"]`, or uninstall this plugin.\n\n## Usage\n\n```python\nfrom pipen import Proc, Pipen\n\n\nclass Poplog(Proc):\n input = \"var:var\"\n input_data = [0, 1, 2]\n script = \"\"\"\n echo -n \"[PIPEN-POPLOG][INFO] Log message \"\n sleep 1 # Simulate message not read in time\n echo \"by {{in.var}} 1\"\n sleep 1\n echo \"[PIPEN-POPLOG][ERROR] Log message by {{in.var}} 2\"\n sleep 1\n echo \"[PIPEN-POPLOG][INFO] Log message by {{in.var}} 3\"\n \"\"\"\n\n\nif __name__ == \"__main__\":\n Pipen().run()\n```\n\n```\n01-12 11:23:52 I core \u256d\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 PoplogDefault \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256e\n01-12 11:23:52 I core \u2551 A default poplog proc \u2551\n01-12 11:23:52 I core \u2570\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256f\n01-12 11:23:52 I core PoplogDefault: Workdir: '.pipen/Pipeline/PoplogDefault'\n01-12 11:23:52 I core PoplogDefault: <<< [START]\n01-12 11:23:52 I core PoplogDefault: >>> [END]\n01-12 11:23:56 I poplog PoplogDefault: [0/2] Log message by 0 1\n01-12 11:23:59 E poplog PoplogDefault: [0/2] Log message by 0 2\n01-12 11:24:02 I poplog PoplogDefault: [0/2] Log message by 0 3\n```\n\n## Configuration\n\n- `plugin_opts.poplog_loglevel`: The log level for poplog. Default: `info`.\n- `plugin_opts.poplog_pattern`: The pattern to match the log message. Default: `r'\\[PIPEN-POPLOG\\]\\[(?P<level>\\w+)\\] (?P<message>.*)'`.\n- `plugin_opts.poplog_jobs`: The job indices to be populated. Default: `[0]` (the first job).\n- `plugin_opts.poplog_max`: The total max number of the log message to be poplutated. Default: `99`.\n- `plugin_opts.poplog_source`: The source of the log message. Default: `stdout`.\n\n\n[1]: https://github.com/pwwang/pipen\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Populate logs from jobs to running log of the pipeline",
"version": "0.2.0",
"project_urls": {
"Homepage": "https://github.com/pwwang/pipen-poplog",
"Repository": "https://github.com/pwwang/pipen-poplog"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "bdb4be9299d08cbfb1bc5e939bdd438da467b38afca447d1155780330a1858a4",
"md5": "2983daa4a902ea97ef3a0cc970361f31",
"sha256": "0cdbf3a86eae24b08e48d9b543f280494349283f9d4c989487253923d46703e8"
},
"downloads": -1,
"filename": "pipen_poplog-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2983daa4a902ea97ef3a0cc970361f31",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 4399,
"upload_time": "2024-07-23T22:57:32",
"upload_time_iso_8601": "2024-07-23T22:57:32.773981Z",
"url": "https://files.pythonhosted.org/packages/bd/b4/be9299d08cbfb1bc5e939bdd438da467b38afca447d1155780330a1858a4/pipen_poplog-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "29ad14fe41678f1f00549e5632b121460b03084ec992f2b965762d21c9032c65",
"md5": "1afbc35f7917b95e700f2899d5733a9a",
"sha256": "d1413240755ebfebeade5ea77c89b7aa1dd31f7099e293a4eb9f04cbbb10a4f4"
},
"downloads": -1,
"filename": "pipen_poplog-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "1afbc35f7917b95e700f2899d5733a9a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 4243,
"upload_time": "2024-07-23T22:57:34",
"upload_time_iso_8601": "2024-07-23T22:57:34.842440Z",
"url": "https://files.pythonhosted.org/packages/29/ad/14fe41678f1f00549e5632b121460b03084ec992f2b965762d21c9032c65/pipen_poplog-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-23 22:57:34",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "pwwang",
"github_project": "pipen-poplog",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pipen-poplog"
}