wily\commands\list_metrics.py
-- -- --- --- --- --- --- --- ------- ------- ------- | """
-- -- --- --- --- --- --- --- ------- ------- ------- | List available metrics across all providers.
-- -- --- --- --- --- --- --- ------- ------- ------- |
-- -- --- --- --- --- --- --- ------- ------- ------- | TODO : Only show metrics for the operators that the cache has?
-- -- --- --- --- --- --- --- ------- ------- ------- | """
-- -- --- --- --- --- --- --- ------- ------- ------- | import tabulate
-- -- --- --- --- --- --- --- ------- ------- ------- |
-- -- --- --- --- --- --- --- ------- ------- ------- | from wily.config import DEFAULT_GRID_STYLE
-- -- --- --- --- --- --- --- ------- ------- ------- | from wily.operators import ALL_OPERATORS
-- -- --- --- --- --- --- --- ------- ------- ------- |
-- -- --- --- --- --- --- --- ------- ------- ------- |
-- 03 001 002 001 002 003 003 0004.75 0002.38 0000.50 | def list_metrics():
-- 03 001 002 001 002 003 003 0004.75 0002.38 0000.50 | """List metrics available."""
-- 03 001 002 001 002 003 003 0004.75 0002.38 0000.50 | for name, operator in ALL_OPERATORS.items():
-- 03 001 002 001 002 003 003 0004.75 0002.38 0000.50 | print(f"{name} operator:")
-- 03 001 002 001 002 003 003 0004.75 0002.38 0000.50 | if len(operator.cls.metrics) > 0:
-- 03 001 002 001 002 003 003 0004.75 0002.38 0000.50 | print(
-- 03 001 002 001 002 003 003 0004.75 0002.38 0000.50 | tabulate.tabulate(
-- 03 001 002 001 002 003 003 0004.75 0002.38 0000.50 | headers=("Name", "Description", "Type"),
-- 03 001 002 001 002 003 003 0004.75 0002.38 0000.50 | tabular_data=operator.cls.metrics,
-- 03 001 002 001 002 003 003 0004.75 0002.38 0000.50 | tablefmt=DEFAULT_GRID_STYLE,
-- -- 001 002 001 002 003 003 0004.75 0002.38 0000.50 | )
-- -- --- --- --- --- --- --- ------- ------- ------- | )