test-bugzilla-files/new-control.py | 11 +++++++++++ test-bugzilla-files/zip.sh | 8 ++++++++ 2 files changed, 19 insertions(+)
New commits: commit 6b7fd54d6da91b4253df19692a2ead2d22943f5c Author: Gülşah Köse <gulsah.k...@collabora.com> AuthorDate: Thu Sep 16 19:03:46 2021 +0300 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Fri Sep 17 10:11:34 2021 +0200 Show a warning if CPU load average is higher than limit. If CPU load average is higher than limit, we will add a warning line to mail body. Change-Id: If73f82e868639ca02bf224bf07bf0c37fcf1ec3a Reviewed-on: https://gerrit.libreoffice.org/c/dev-tools/+/122200 Tested-by: Miklos Vajna <vmik...@collabora.com> Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/test-bugzilla-files/new-control.py b/test-bugzilla-files/new-control.py index 10479a4..a83c65a 100644 --- a/test-bugzilla-files/new-control.py +++ b/test-bugzilla-files/new-control.py @@ -88,6 +88,16 @@ def checkDiskSpace(): diskusagefile.write(str(freeGiB)) diskusagefile.close() +def checkCPULoadAverage(): + cpuload, _, _ = os.getloadavg() + cpuload /= float(os.cpu_count()) + limit = 0.9 + + if cpuload > limit: + cpuusagefile = open("/srv/crashtestdata/cpuusageinfo.txt", "w") + cpuusagefile.write(str(cpuload)) + cpuusagefile.close() + def usage(): message = """usage: {program} [option] dir" - h | --help: print usage information @@ -122,6 +132,7 @@ if __name__ == "__main__": if asan == 1: workers = 64 + checkCPULoadAverage() checkDiskSpace() with concurrent.futures.ThreadPoolExecutor(max_workers=workers) as executor: future_to_task = {executor.submit(execute_task, task_file, asan): task_file for task_file in get_tasks(directory, task_size)} diff --git a/test-bugzilla-files/zip.sh b/test-bugzilla-files/zip.sh index 0ad6f11..a0c2202 100755 --- a/test-bugzilla-files/zip.sh +++ b/test-bugzilla-files/zip.sh @@ -39,6 +39,13 @@ if [ -e $diskusagefile ]; then free_disk_space="$(cat $diskusagefile)" rm $diskusagefile fi + +cpuusagefile=$CRASHTESTDATA/cpuusageinfo.txt +if [ -e $cpuusagefile ]; then + cpu_usage="$(cat $cpuusagefile)" + rm $cpuusagefile +fi + cat << EOF > mail.txt Hi, @@ -53,6 +60,7 @@ $num_of_odf_diffs files have differences compared to the previous run. EOF [ ! -z "${free_disk_space}" ] && echo "Warning! Remaining disk space is ${free_disk_space} GiB." >> mail.txt && echo "" >> mail.txt +[ ! -z "${cpu_usage}" ] && echo "Warning! CPU load average is ${cpu_usage}." >> mail.txt && echo "" >> mail.txt cat << EOF >> mail.txt - Your friendly crashtest bot