Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,26 @@ DFAnalyzer also provides a detailed breakdown of performance metrics for each la
└─────────────────────────────┴──────────────────┴────────────────┴───────────┴────────────────────┴──────────────────┘
```

## Report mode

You can now run all of the existing `dfreport.py` reports directly through the main `dfanalyzer` executable:

```bash
# per-node summary:
dfanalyzer --report --node /path/to/COMPACT/

# per-process, highlight the max across processes:
dfanalyzer --report --process --aggregate /path/to/COMPACT/
```
#### How it works

- **`cli()`** inspects `sys.argv` before Hydra ever sees it.
- If `--report` is present, we strip it out (so `argparse` in `dfreport.py` still works unchanged) and call `dfreport.main()`.
- Otherwise we call the original `main()`, so nothing else in your toolchain is disturbed.
- Finally, by repointing the `dfanalyzer` console script to `cli()`, any `dfanalyzer ...` invocation will first check for `--report`.

This gives you exactly what you asked for `dfanalyzer --report [dfreport options]` with minimal changes to the rest of the repo.

## Further Information

For more details, to report issues, or to contribute to DFAnalyzer, please refer to the following resources:
Expand Down
19 changes: 17 additions & 2 deletions dfanalyzer/__main__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# File: dfanalyzer/dfanalyzer/__main__.py

import sys
import hydra
import structlog
from distributed import Client
Expand All @@ -14,6 +17,18 @@
filter_warnings()
init_hydra_config_store()

def cli():
"""
Dispatch between the new --report mode and the usual Hydra-powered analysis.
"""
if '--report' in sys.argv:
# Remove our flag so dfreport.py sees only its own args
sys.argv.remove('--report')
from .utils.dfreport import main as report_main
report_main()
else:
main()

@hydra.main(version_base=None, config_name="config")
def main(cfg: Config) -> None:
# Configure structlog + stdlib logging
Expand Down Expand Up @@ -60,6 +75,6 @@ def main(cfg: Config) -> None:
if not isinstance(cluster, ExternalCluster):
cluster.close() # type: ignore


if __name__ == "__main__":
main()
cli()

Loading