# hawk-utils-scripts/monitoring/db Use this directory for scripts, etc, that operate on or extract data from the the database. ## scripts/get_detailed_power.py Python script which querries the database for a list of jobids and produces a file for each jobid. Those files contain time-resolved power consumption data and are meant to be consumed by the utility in [monitoring/logs/scripts/plot_energy_logs.sh](../logs/README.md#scripts/plot_energy_logs.sh). Requirements: - Python module sqlalchemy `python -m pip install sqlalchemy psycopg2-binary` Usage: ```bash ssh monitoring ./get_detailed_power.py --help ./get_detailed_power.py 2335001 7678069.hawk-pbs5 Created file detailed_power.2335001.hawk-pbs5.100000-1000004.csv Created file detailed_power.7678069.hawk-pbs5.2432345-423423.csv ``` Querrying Hawk-AI nodes requires the option `--hawk-ai`. The time resolution can be set with the option `--interval`. Note, that small intervals will lead to data gaps. In particular, not all nodes will report power values for a given time stamp. Multiple values within an interval are averaged arithmetically. This migth make it difficult to use the output of this script to calculate total energy used by a job.