[SERVER-41108] evergreen_generate_resmoke_tasks fails with a divide by zero exception Created: 13/May/19  Updated: 29/Oct/23  Resolved: 16/May/19

Status: Closed
Project: Core Server
Component/s: Testing Infrastructure
Affects Version/s: None
Fix Version/s: 4.1.12

Type: Bug Priority: Major - P3
Reporter: David Bradford (Inactive) Assignee: Lydia Stepanek (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: DAG 2019-05-20, DAG 2019-06-03
Participants:

 Description   

It looks like we will occasionally get results from the test history endpoint that do not have any recorded executions. The code to split resmoke tasks assumes there will be at least one execution. When there are 0, it will hit an exception. We should handle that case.

See this failure for an example.

[2019/05/13 00:24:05.571] [2019-05-13 04:24:05,571 - evergreen.api - DEBUG] Request https://evergreen.mongodb.com/rest/v2/projects/mongodb-mongo-master/test_stats?after_date=2019-04-29&before_date=2019-05-13&group_by=test&group_num_days=14&limit=1000&start_at=2019-04-29%7C%7C%7Cobjid5%3ACheckReplDBHashInBackground%7C&tasks=sharded_causally_consistent_jscore_passthrough&variants=enterprise-rhel-62-64-bit-inmem took 0.140000s
 [2019/05/13 00:24:05.578] /data/mci/8d603e2dae92bed62271bec6d86d3b5e/src/buildscripts/util/read_config.py:42: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
 [2019/05/13 00:24:05.578]   config_file_data = yaml.load(file_handle)
 [2019/05/13 00:24:05.580] Traceback (most recent call last):
 [2019/05/13 00:24:05.580]   File "buildscripts/evergreen_generate_resmoke_tasks.py", line 709, in <module>
 [2019/05/13 00:24:05.580]     Main(EvergreenApi.get_api(config_file=CONFIG_FILE)).main()
 [2019/05/13 00:24:05.580]   File "buildscripts/evergreen_generate_resmoke_tasks.py", line 698, in main
 [2019/05/13 00:24:05.580]     suites = self.calculate_suites(start_date, end_date)
 [2019/05/13 00:24:05.580]   File "buildscripts/evergreen_generate_resmoke_tasks.py", line 621, in calculate_suites
 [2019/05/13 00:24:05.580]     return self.calculate_suites_from_evg_stats(evg_stats, target_execution_time_secs)
 [2019/05/13 00:24:05.580]   File "buildscripts/evergreen_generate_resmoke_tasks.py", line 644, in calculate_suites_from_evg_stats
 [2019/05/13 00:24:05.580]     test_stats = TestStats(data)
 [2019/05/13 00:24:05.580]   File "buildscripts/evergreen_generate_resmoke_tasks.py", line 460, in __init__
 [2019/05/13 00:24:05.580]     self._add_stats(doc)
 [2019/05/13 00:24:05.580]   File "buildscripts/evergreen_generate_resmoke_tasks.py", line 469, in _add_stats
 [2019/05/13 00:24:05.580]     self._add_test_hook_stats(test_file, duration, num_run)
 [2019/05/13 00:24:05.580]   File "buildscripts/evergreen_generate_resmoke_tasks.py", line 480, in _add_test_hook_stats
 [2019/05/13 00:24:05.580]     self._add_runtime_info(self._hook_runtime_by_test, test_name, duration, num_run)
 [2019/05/13 00:24:05.580]   File "buildscripts/evergreen_generate_resmoke_tasks.py", line 490, in _add_runtime_info
 [2019/05/13 00:24:05.580]     runtime_info["duration"], runtime_info["num_run"], duration, num_run)
 [2019/05/13 00:24:05.580]   File "buildscripts/evergreen_generate_resmoke_tasks.py", line 496, in _average
 [2019/05/13 00:24:05.580]     return float(value_a * num_a + value_b * num_b) / (num_a + num_b)
 [2019/05/13 00:24:05.580] ZeroDivisionError: float division by zero
 [2019/05/13 00:24:05.605] Command failed: command encountered problem: exit status 1

{
"test_file": "sort_numeric:CleanEveryN",
"task_name": "",
"variant": "",
"distro": "",
"date": "2019-04-29",
"num_pass": 0,
"num_fail": 0,
"avg_duration_pass": 0
}



 Comments   
Comment by Githook User [ 16/May/19 ]

Author:

{'name': 'Lydia Stepanek', 'username': 'lydiastepanek', 'email': 'lydia.stepanek@mongodb.com'}

Message: SERVER-41108 handle evergreen_generate_resmoke_tasks divide by zero exception
Branch: master
https://github.com/mongodb/mongo/commit/c9397433452042337c5a3307f7a5b5d233fd8f85

Generated at Thu Feb 08 04:56:50 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.