Skip to content

Fix rate test by catching exception when parsing CPU time

Shunan Zhang requested to merge fix-rate-test into master

Try to catch the exception when running Hlt2 rate test as shown here: https://eoslhcbhttp.cern.ch//eos/lhcb/storage/lhcbpr/logs/Moore/Moore_hlt2_rate_and_size/lhcb-head.3323_2022-07-22_03:31:24_+0200/run.log

Traceback (most recent call last):
  File "/cvmfs/lhcb.cern.ch/lib/lcg/releases/Python/3.9.6-b0f98/x86_64-centos7-gcc11-opt/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/cvmfs/lhcb.cern.ch/lib/lcg/releases/Python/3.9.6-b0f98/x86_64-centos7-gcc11-opt/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/lhcbpr/jenkins/perf/workspace/nightly-builds/tests/build/DBASE/PRConfig/v999r999/python/MooreTests/run_rate_test_jobs.py", line 357, in <module>
    *proc_stats(pids)))
  File "/home/lhcbpr/jenkins/perf/workspace/nightly-builds/tests/build/DBASE/PRConfig/v999r999/python/MooreTests/run_rate_test_jobs.py", line 140, in proc_stats
    cputime = sum(parse_time(x[1]) for x in data)
  File "/home/lhcbpr/jenkins/perf/workspace/nightly-builds/tests/build/DBASE/PRConfig/v999r999/python/MooreTests/run_rate_test_jobs.py", line 140, in <genexpr>
    cputime = sum(parse_time(x[1]) for x in data)
  File "/home/lhcbpr/jenkins/perf/workspace/nightly-builds/tests/build/DBASE/PRConfig/v999r999/python/MooreTests/run_rate_test_jobs.py", line 128, in parse_time
    return sum(m * int(x) for m, x in zip([3600, 60, 1], s.split(':')))
  File "/home/lhcbpr/jenkins/perf/workspace/nightly-builds/tests/build/DBASE/PRConfig/v999r999/python/MooreTests/run_rate_test_jobs.py", line 128, in <genexpr>
    return sum(m * int(x) for m, x in zip([3600, 60, 1], s.split(':')))
ValueError: invalid literal for int() with base 10: '1-00'

It's still unclear to me why does the time string contain a -, but this fix could tell us what is the time string when the exception occurs, without interrupting the rate test.

Merge request reports