зеркало из https://github.com/mozilla/bugbug.git
Ensure we select the least possible number of configurations
This commit is contained in:
Родитель
f4a91cb012
Коммит
945e524a3c
|
@ -355,21 +355,19 @@ class TestSelectModel(Model):
|
|||
|
||||
sorted_tasks = sorted(tasks)
|
||||
for i, task1 in enumerate(sorted_tasks):
|
||||
create_group(task1)
|
||||
|
||||
try:
|
||||
failing_together_stats = load_failing_together(task1)
|
||||
except KeyError:
|
||||
if not assume_redundant:
|
||||
create_group(task1)
|
||||
continue
|
||||
else:
|
||||
failing_together_stats = {}
|
||||
failing_together_stats = {}
|
||||
|
||||
for task2 in sorted_tasks[i + 1 :]:
|
||||
try:
|
||||
support, confidence = failing_together_stats[task2]
|
||||
except KeyError:
|
||||
if not assume_redundant:
|
||||
continue
|
||||
confidence = 0.0
|
||||
else:
|
||||
confidence = 1.0
|
||||
|
||||
|
@ -378,10 +376,6 @@ class TestSelectModel(Model):
|
|||
else:
|
||||
mark_incompatible(task1, task2)
|
||||
|
||||
# Create group consisting only of task1, if there was nothing equivalent
|
||||
# with it.
|
||||
create_group(task1)
|
||||
|
||||
return groups
|
||||
|
||||
def _get_equivalence_sets(self, min_redundancy_confidence: float):
|
||||
|
@ -447,7 +441,10 @@ class TestSelectModel(Model):
|
|||
return True
|
||||
|
||||
def reduce(
|
||||
self, tasks: Collection[str], min_redundancy_confidence: float
|
||||
self,
|
||||
tasks: Collection[str],
|
||||
min_redundancy_confidence: float,
|
||||
assume_redundant: bool = False,
|
||||
) -> Set[str]:
|
||||
failing_together = test_scheduling.get_failing_together_db(
|
||||
self.granularity, True
|
||||
|
@ -464,7 +461,7 @@ class TestSelectModel(Model):
|
|||
task_vars = {task: solver.BoolVar(task) for task in tasks}
|
||||
|
||||
equivalence_sets = self._generate_equivalence_sets(
|
||||
tasks, min_redundancy_confidence, load_failing_together, False
|
||||
tasks, min_redundancy_confidence, load_failing_together, assume_redundant
|
||||
)
|
||||
|
||||
# Create constraints to ensure at least one task from each set of equivalent
|
||||
|
|
|
@ -206,7 +206,7 @@ def test_reduce5(failing_together: LMDBDict) -> None:
|
|||
{"linux1804-64/opt-a", "windows10/opt-c", "windows10/opt-d"}, 1.0
|
||||
)
|
||||
assert result == {
|
||||
"linux1804-64/opt-a",
|
||||
"windows10/opt-d",
|
||||
}
|
||||
|
||||
|
||||
|
@ -255,8 +255,32 @@ def test_reduce6(failing_together: LMDBDict) -> None:
|
|||
)
|
||||
|
||||
|
||||
@pytest.mark.xfail
|
||||
def test_reduce7(failing_together: LMDBDict) -> None:
|
||||
failing_together[b"windows10/opt-1"] = pickle.dumps(
|
||||
{
|
||||
"windows10/opt-3": (0.1, 0.0),
|
||||
"windows10/opt-5": (0.1, 1.0),
|
||||
}
|
||||
)
|
||||
failing_together[b"windows10/opt-3"] = pickle.dumps(
|
||||
{
|
||||
"windows10/opt-5": (0.1, 1.0),
|
||||
}
|
||||
)
|
||||
|
||||
model = TestLabelSelectModel()
|
||||
result = model.reduce(
|
||||
{
|
||||
"windows10/opt-1",
|
||||
"windows10/opt-3",
|
||||
"windows10/opt-5",
|
||||
},
|
||||
1.0,
|
||||
)
|
||||
assert result == {"windows10/opt-5"}
|
||||
|
||||
|
||||
def test_reduce8(failing_together: LMDBDict) -> None:
|
||||
failing_together[b"windows10/opt-1"] = pickle.dumps(
|
||||
{
|
||||
"windows10/opt-5": (0.1, 1.0),
|
||||
|
@ -292,38 +316,251 @@ def test_reduce7(failing_together: LMDBDict) -> None:
|
|||
},
|
||||
1.0,
|
||||
)
|
||||
assert (
|
||||
result
|
||||
== {
|
||||
assert result == {"windows10/opt-0", "windows10/opt-5", "windows10/opt-6"}
|
||||
|
||||
|
||||
def test_reduce9(failing_together: LMDBDict) -> None:
|
||||
failing_together[b"windows10/opt-0"] = pickle.dumps(
|
||||
{
|
||||
"windows10/opt-5": (0.1, 0.0),
|
||||
}
|
||||
)
|
||||
failing_together[b"windows10/opt-1"] = pickle.dumps(
|
||||
{
|
||||
"windows10/opt-5": (0.1, 1.0),
|
||||
}
|
||||
)
|
||||
failing_together[b"windows10/opt-2"] = pickle.dumps(
|
||||
{
|
||||
"windows10/opt-6": (0.1, 1.0),
|
||||
}
|
||||
)
|
||||
failing_together[b"windows10/opt-3"] = pickle.dumps(
|
||||
{
|
||||
"windows10/opt-4": (0.1, 1.0),
|
||||
"windows10/opt-5": (0.1, 1.0),
|
||||
}
|
||||
)
|
||||
failing_together[b"windows10/opt-4"] = pickle.dumps(
|
||||
{
|
||||
"windows10/opt-6": (0.1, 1.0),
|
||||
}
|
||||
)
|
||||
|
||||
model = TestLabelSelectModel()
|
||||
result = model.reduce(
|
||||
{
|
||||
"windows10/opt-0",
|
||||
"windows10/opt-1",
|
||||
}
|
||||
or result
|
||||
== {
|
||||
"windows10/opt-0",
|
||||
"windows10/opt-2",
|
||||
}
|
||||
or result
|
||||
== {
|
||||
"windows10/opt-0",
|
||||
"windows10/opt-3",
|
||||
}
|
||||
or result
|
||||
== {
|
||||
"windows10/opt-0",
|
||||
"windows10/opt-4",
|
||||
}
|
||||
or result
|
||||
== {
|
||||
"windows10/opt-0",
|
||||
"windows10/opt-5",
|
||||
}
|
||||
or result
|
||||
== {
|
||||
"windows10/opt-0",
|
||||
"windows10/opt-6",
|
||||
},
|
||||
1.0,
|
||||
)
|
||||
assert result == {"windows10/opt-0", "windows10/opt-5", "windows10/opt-6"}
|
||||
|
||||
|
||||
def test_reduce10(failing_together: LMDBDict) -> None:
|
||||
failing_together[b"windows10/opt-3"] = pickle.dumps(
|
||||
{
|
||||
"windows10/opt-5": (0.1, 1.0),
|
||||
}
|
||||
)
|
||||
failing_together[b"windows10/opt-4"] = pickle.dumps(
|
||||
{
|
||||
"windows10/opt-6": (0.1, 1.0),
|
||||
}
|
||||
)
|
||||
failing_together[b"windows10/opt-5"] = pickle.dumps(
|
||||
{
|
||||
"windows10/opt-6": (0.1, 1.0),
|
||||
}
|
||||
)
|
||||
|
||||
model = TestLabelSelectModel()
|
||||
result = model.reduce(
|
||||
{
|
||||
"windows10/opt-0",
|
||||
"windows10/opt-1",
|
||||
"windows10/opt-2",
|
||||
"windows10/opt-3",
|
||||
"windows10/opt-4",
|
||||
"windows10/opt-5",
|
||||
"windows10/opt-6",
|
||||
},
|
||||
1.0,
|
||||
)
|
||||
assert result == {
|
||||
"windows10/opt-0",
|
||||
"windows10/opt-1",
|
||||
"windows10/opt-2",
|
||||
"windows10/opt-3",
|
||||
"windows10/opt-6",
|
||||
} or result == {
|
||||
"windows10/opt-0",
|
||||
"windows10/opt-1",
|
||||
"windows10/opt-2",
|
||||
"windows10/opt-4",
|
||||
"windows10/opt-5",
|
||||
}
|
||||
|
||||
|
||||
def test_reduce11(failing_together: LMDBDict) -> None:
|
||||
failing_together[b"windows10/opt-1"] = pickle.dumps(
|
||||
{
|
||||
"windows10/opt-2": (0.1, 0.0),
|
||||
"windows10/opt-3": (0.1, 1.0),
|
||||
}
|
||||
)
|
||||
failing_together[b"windows10/opt-2"] = pickle.dumps(
|
||||
{
|
||||
"windows10/opt-3": (0.1, 1.0),
|
||||
}
|
||||
)
|
||||
|
||||
model = TestLabelSelectModel()
|
||||
result = model.reduce(
|
||||
{
|
||||
"windows10/opt-1",
|
||||
"windows10/opt-2",
|
||||
"windows10/opt-3",
|
||||
},
|
||||
1.0,
|
||||
)
|
||||
assert result == {"windows10/opt-3"}
|
||||
|
||||
|
||||
def test_reduce12(failing_together: LMDBDict) -> None:
|
||||
failing_together[b"windows10/opt-0"] = pickle.dumps(
|
||||
{
|
||||
"windows10/opt-1": (0.1, 0.0),
|
||||
"windows10/opt-2": (0.1, 0.0),
|
||||
"windows10/opt-3": (0.1, 0.0),
|
||||
"windows10/opt-4": (0.1, 0.0),
|
||||
"windows10/opt-5": (0.1, 0.0),
|
||||
}
|
||||
)
|
||||
failing_together[b"windows10/opt-1"] = pickle.dumps(
|
||||
{
|
||||
"windows10/opt-2": (0.1, 0.0),
|
||||
"windows10/opt-3": (0.1, 0.0),
|
||||
"windows10/opt-4": (0.1, 0.0),
|
||||
"windows10/opt-5": (0.1, 0.0),
|
||||
}
|
||||
)
|
||||
failing_together[b"windows10/opt-2"] = pickle.dumps(
|
||||
{
|
||||
"windows10/opt-3": (0.1, 0.0),
|
||||
"windows10/opt-4": (0.1, 1.0),
|
||||
"windows10/opt-5": (0.1, 0.0),
|
||||
}
|
||||
)
|
||||
failing_together[b"windows10/opt-3"] = pickle.dumps(
|
||||
{
|
||||
"windows10/opt-4": (0.1, 0.0),
|
||||
"windows10/opt-5": (0.1, 1.0),
|
||||
}
|
||||
)
|
||||
failing_together[b"windows10/opt-4"] = pickle.dumps(
|
||||
{
|
||||
"windows10/opt-5": (0.1, 1.0),
|
||||
}
|
||||
)
|
||||
|
||||
model = TestLabelSelectModel()
|
||||
result = model.reduce(
|
||||
{
|
||||
"windows10/opt-0",
|
||||
"windows10/opt-1",
|
||||
"windows10/opt-2",
|
||||
"windows10/opt-3",
|
||||
"windows10/opt-4",
|
||||
"windows10/opt-5",
|
||||
},
|
||||
1.0,
|
||||
)
|
||||
assert result == {
|
||||
"windows10/opt-0",
|
||||
"windows10/opt-1",
|
||||
"windows10/opt-2",
|
||||
"windows10/opt-5",
|
||||
} or result == {
|
||||
"windows10/opt-0",
|
||||
"windows10/opt-1",
|
||||
"windows10/opt-3",
|
||||
"windows10/opt-4",
|
||||
}
|
||||
|
||||
|
||||
def test_reduce13(failing_together: LMDBDict) -> None:
|
||||
failing_together[b"windows10/opt-2"] = pickle.dumps(
|
||||
{
|
||||
"windows10/opt-3": (0.1, 0.0),
|
||||
"windows10/opt-4": (0.1, 1.0),
|
||||
"windows10/opt-5": (0.1, 0.0),
|
||||
}
|
||||
)
|
||||
failing_together[b"windows10/opt-3"] = pickle.dumps(
|
||||
{
|
||||
"windows10/opt-4": (0.1, 0.0),
|
||||
"windows10/opt-5": (0.1, 1.0),
|
||||
}
|
||||
)
|
||||
|
||||
model = TestLabelSelectModel()
|
||||
result = model.reduce(
|
||||
{
|
||||
"windows10/opt-2",
|
||||
"windows10/opt-3",
|
||||
"windows10/opt-4",
|
||||
"windows10/opt-5",
|
||||
},
|
||||
1.0,
|
||||
True,
|
||||
)
|
||||
assert result == {"windows10/opt-2", "windows10/opt-5"} or result == {
|
||||
"windows10/opt-3",
|
||||
"windows10/opt-4",
|
||||
}
|
||||
|
||||
|
||||
def test_reduce14(failing_together: LMDBDict) -> None:
|
||||
failing_together[b"windows10/opt-1"] = pickle.dumps(
|
||||
{
|
||||
"windows10/opt-3": (0.1, 1.0),
|
||||
}
|
||||
)
|
||||
failing_together[b"windows10/opt-2"] = pickle.dumps(
|
||||
{
|
||||
"windows10/opt-4": (0.1, 1.0),
|
||||
}
|
||||
)
|
||||
failing_together[b"windows10/opt-3"] = pickle.dumps(
|
||||
{
|
||||
"windows10/opt-4": (0.1, 1.0),
|
||||
}
|
||||
)
|
||||
|
||||
model = TestLabelSelectModel()
|
||||
result = model.reduce(
|
||||
{
|
||||
"windows10/opt-1",
|
||||
"windows10/opt-2",
|
||||
"windows10/opt-3",
|
||||
"windows10/opt-4",
|
||||
},
|
||||
1.0,
|
||||
True,
|
||||
)
|
||||
assert (
|
||||
result == {"windows10/opt-1"}
|
||||
or result == {"windows10/opt-2"}
|
||||
or result == {"windows10/opt-3"}
|
||||
or result == {"windows10/opt-4"}
|
||||
)
|
||||
|
||||
|
||||
@st.composite
|
||||
|
|
Загрузка…
Ссылка в новой задаче