def get_and_update_past_failures(type_, task, items, push_num, is_regression): if type_ not in past_failures: past_failures[type_] = {} if task not in past_failures[type_]: past_failures[type_][task] = {} values_total = [] values_prev_7 = [] values_prev_14 = [] values_prev_28 = [] values_prev_56 = [] for item in items: if item not in past_failures[type_][task]: past_failures[type_][task][item] = ExpQueue( push_num, HISTORICAL_TIMESPAN + 1, 0 ) value = past_failures[type_][task][item][push_num] values_total.append(value) values_prev_7.append( value - past_failures[type_][task][item][push_num - 7] ) values_prev_14.append( value - past_failures[type_][task][item][push_num - 14] ) values_prev_28.append( value - past_failures[type_][task][item][push_num - 28] ) values_prev_56.append( value - past_failures[type_][task][item][push_num - 56] ) if is_regression: past_failures[type_][task][item][push_num] = value + 1 return ( sum(values_total), sum(values_prev_7), sum(values_prev_14), sum(values_prev_28), sum(values_prev_56), )
def _read_and_update_past_failures( past_failures, type_, runnable, items, push_num, is_regression ): values_total = [] values_prev_700 = [] values_prev_1400 = [] values_prev_2800 = [] key = f"{type_}${runnable}$" for item in items: full_key = key + item is_new = full_key not in past_failures if is_new: if not is_regression: continue cur = ExpQueue(round(push_num / 100), int(HISTORICAL_TIMESPAN / 100) + 1, 0) else: cur = past_failures[full_key] value = cur[round(push_num / 100)] values_total.append(value) values_prev_700.append(value - cur[round((push_num - 700) / 100)]) values_prev_1400.append(value - cur[round((push_num - 1400) / 100)]) values_prev_2800.append(value - cur[round((push_num - 2800) / 100)]) if is_regression: cur[round(push_num / 100)] = value + 1 if is_new: past_failures[full_key] = cur return ( sum(values_total), sum(values_prev_700), sum(values_prev_1400), sum(values_prev_2800), )
def _read_and_update_past_failures( past_failures, type_, task, items, push_num, is_regression ): values_total = [] values_prev_7 = [] values_prev_14 = [] values_prev_28 = [] values_prev_56 = [] key = f"{type_}${task}$" for item in items: full_key = key + item if full_key not in past_failures: cur = past_failures[full_key] = ExpQueue( push_num, HISTORICAL_TIMESPAN + 1, 0 ) else: cur = past_failures[full_key] value = cur[push_num] values_total.append(value) values_prev_7.append(value - cur[push_num - 7]) values_prev_14.append(value - cur[push_num - 14]) values_prev_28.append(value - cur[push_num - 28]) values_prev_56.append(value - cur[push_num - 56]) if is_regression: cur[push_num] = value + 1 return ( sum(values_total), sum(values_prev_7), sum(values_prev_14), sum(values_prev_28), sum(values_prev_56), )