{"id":34793889,"url":"https://github.com/paquiteau/hydra-callbacks","last_synced_at":"2025-12-25T10:02:18.668Z","repository":{"id":146265267,"uuid":"616369834","full_name":"paquiteau/hydra-callbacks","owner":"paquiteau","description":"A collection of usefull hydra callbacks","archived":false,"fork":false,"pushed_at":"2024-09-03T06:35:41.000Z","size":269,"stargazers_count":14,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-03T10:31:03.452Z","etag":null,"topics":["callbacks","configuration","hydra","runner","workflow"],"latest_commit_sha":null,"homepage":"https://paquiteau.github.io/hydra-callbacks/","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/paquiteau.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2023-03-20T08:58:00.000Z","updated_at":"2025-09-10T15:37:14.000Z","dependencies_parsed_at":"2023-11-09T11:48:08.079Z","dependency_job_id":"b9c8fd0d-8fc8-4a74-8086-547c2c4c33c1","html_url":"https://github.com/paquiteau/hydra-callbacks","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/paquiteau/hydra-callbacks","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paquiteau%2Fhydra-callbacks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paquiteau%2Fhydra-callbacks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paquiteau%2Fhydra-callbacks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paquiteau%2Fhydra-callbacks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paquiteau","download_url":"https://codeload.github.com/paquiteau/hydra-callbacks/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paquiteau%2Fhydra-callbacks/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28026682,"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","status":"online","status_checked_at":"2025-12-25T02:00:05.988Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["callbacks","configuration","hydra","runner","workflow"],"created_at":"2025-12-25T10:01:38.674Z","updated_at":"2025-12-25T10:02:18.663Z","avatar_url":"https://github.com/paquiteau.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hydra Callbacks \n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/paquiteau/hydra-callbacks/master/docs/img/hydra_callbacks.jpeg\" width=\"400px\" /\u003e\n\u003c/p\u003e\n\n[![style](https://img.shields.io/badge/style-black-black)](https://github.com/psf/black)\n[![framework](https://img.shields.io/badge/framework-hydra-blue)](https://hydra.cc)\n[![codecov](https://codecov.io/gh/paquiteau/hydra-callbacks/branch/master/graph/badge.svg?token=NEV7SY24YB)](https://codecov.io/gh/paquiteau/hydra-callbacks)\n[![CD](https://github.com/paquiteau/hydra-callbacks/actions/workflows/master-cd.yml/badge.svg)](https://github.com/paquiteau/hydra-callbacks/actions/workflows/master-cd.yml)\n[![CI](https://github.com/paquiteau/hydra-callbacks/actions/workflows/test-ci.yml/badge.svg)](https://github.com/paquiteau/hydra-callbacks/actions/workflows/test-ci.yml)\n[![Release](https://img.shields.io/github/v/release/paquiteau/hydra-callbacks)](https://github.com/paquiteau/hydra-callbacks/releases/latest)\n\n\n\nA collection of usefulls and simple to use callbacks for the [hydra](https://hydra.cc/) configuration framework.\n\n\n## Installation \n``` shell \npip install hydra-callbacks\n```\n\nDevelopment version \n``` shell\npip install git+https://github.com/paquiteau/hydra-callbacks\n```\n\n## Usage \n\nIn your hydra root config file add the following, or analoguous:\n\n``` yaml\nhydra:\n  callbacks:\n    git_infos:\n      _target_: hydra_callbacks.GitInfo\n      clean: true\n    latest_run:\n      _target_: hydra_callbacks.LatestRunLink\n    resource_monitor:\n      _target_: hydra_callbacks.ResourceMonitor\n      sample_interval: 0.5\n    runtime_perf:\n      _target_: hydra_callbacks.RuntimePerformance      \n```\n\nThis will enrich your script output with: \n\n```console\npaquiteau@laptop$ python my_app.py\n[hydra] Git sha: 844b9ca1a74d8307ef5331351897cebb18f71b88, dirty: False\n\n## All your app log and outputs ##\n\n[hydra][INFO] - Total runtime: 0.51 seconds\n[hydra][INFO] - Writing monitoring data to [...]/outputs/2023-04-06/16-02-46/resource_monitoring.csv\n[hydra][INFO] - Latest run is at: [...]/outputs/latest\n```\n\n\nDetailled configuration for each callback is available in the `tests/test_app/` folder.\n\n## Available Callbacks \n\n| Name               | Action                                             |\n|:-------------------|:---------------------------------------------------|\n| GitInfo            | Check status of Repository                         |\n| LatestRunLink      | Get a link to the latest run                       |\n| MultiRunGatherer   | Gather results json file in a single table         |\n| RuntimePerformance | Get Execution time for each run                    |\n| ResourceMonitor    | Monitor resources of running jobs (CPU and Memory) |\n\nAnd more to come ! \n\n## Also Available \n  \n  - `PerfLogger` : A simple to use performance logger\n  \n```python\n  \nfrom hydra_callbacks import PerfLogger \nimport logging\n\nlog = logging.getLogger(__name__)\ndef main_app(cfg):\n    with PerfLogger(log, \"step1\"):\n        sleep(1)\n\n    with PerfLogger(log, \"step2\"):\n        sleep(2)\n    PerfLogger.recap(log)\n\n```\n - `RessourceMonitorService` : A simple CPU and GPU usage and memory sampler. It launches an extra process to monitor everything.\n \n ```python\nfrom hydra_callbacks.monitor import RessourceMonitorService\nimport os \n \nmonitor = RessourceMonitorService(interval=0.2, gpu_monit=True)\n \nmonitor.start()\n# Launch heavy stuff \nmetrics = monitor.stop()\n\n# Or use it as a context manager\nwith RessourceMonitorService(interval=0.2, gpu_monit=True) as monitor: \n    # launch heavy stuff\n    \nmetrics_values = monitor.get_values()\n```\n\n\n## You too, have cool Callbacks, or idea for one ? \n\nOpen a PR or an issue !\n\n### Possible Ideas\n- A callback that summarize log from multiple runs\n- Monitoring of GPU  using nvitop\n  \n\u003cp align=center\u003e :star2: If you like this work, don't forget to star it and share it 🌟 \u003c/p\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaquiteau%2Fhydra-callbacks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpaquiteau%2Fhydra-callbacks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaquiteau%2Fhydra-callbacks/lists"}