Skip to content

Commit ec9a292

Browse files
ezgicicekfacebook-github-bot
authored andcommitted
Remove old default critical path
Summary: Let's remove the old default backend for critical path. Currently, we have longest-path-graph backend (which stores potentials) almost everywhere in the codebase. We should use that one everywhere and there is no need for the default anymore since it has less functionality. Reviewed By: scottcao Differential Revision: D68267529 fbshipit-source-id: 61b09255f83b6d07a144b59b685216173aa3acfb
1 parent 3acdd83 commit ec9a292

File tree

6 files changed

+7
-267
lines changed

6 files changed

+7
-267
lines changed

app/buck2_build_signals/src/env.rs

+2-9
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,9 @@ impl NodeDuration {
5050

5151
#[derive(Copy, Clone, Dupe, derive_more::Display, Allocative)]
5252
pub enum CriticalPathBackendName {
53+
/// This is the default backend.
5354
#[display("longest-path-graph")]
5455
LongestPathGraph,
55-
#[display("default")]
56-
Default,
5756
#[display("logging")]
5857
Logging,
5958
}
@@ -64,13 +63,7 @@ impl FromStr for CriticalPathBackendName {
6463
fn from_str(s: &str) -> Result<Self, Self::Err> {
6564
if s == "longest-path-graph" {
6665
return Ok(Self::LongestPathGraph);
67-
}
68-
69-
if s == "default" {
70-
return Ok(Self::Default);
71-
}
72-
73-
if s == "logging" {
66+
} else if s == "logging" {
7467
return Ok(Self::Logging);
7568
}
7669

app/buck2_build_signals_impl/src/backend.rs

-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,5 @@
88
*/
99

1010
pub(crate) mod backend;
11-
pub(crate) mod default;
1211
pub(crate) mod logging;
1312
pub(crate) mod longest_path_graph;

app/buck2_build_signals_impl/src/backend/default.rs

-228
This file was deleted.

app/buck2_build_signals_impl/src/lib.rs

-4
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ use tokio_stream::wrappers::UnboundedReceiverStream;
6464
use tokio_stream::StreamExt;
6565

6666
use crate::backend::backend::BuildListenerBackend;
67-
use crate::backend::default::DefaultBackend;
6867
use crate::backend::logging::LoggingBackend;
6968
use crate::backend::longest_path_graph::LongestPathGraphBackend;
7069

@@ -322,9 +321,6 @@ impl DeferredBuildSignals for DeferredBuildSignalsImpl {
322321
CriticalPathBackendName::LongestPathGraph => {
323322
start_backend(events, self.receiver, LongestPathGraphBackend::new(), ctx)
324323
}
325-
CriticalPathBackendName::Default => {
326-
start_backend(events, self.receiver, DefaultBackend::new(), ctx)
327-
}
328324
CriticalPathBackendName::Logging => start_backend(
329325
events.dupe(),
330326
self.receiver,

app/buck2_server/src/ctx.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ impl<'a, 's> DiceCommandUpdater<'a, 's> {
738738
section: "buck2",
739739
property: "critical_path_backend2",
740740
})?
741-
.unwrap_or(CriticalPathBackendName::Default);
741+
.unwrap_or(CriticalPathBackendName::LongestPathGraph);
742742

743743
let override_use_case = root_config.parse::<RemoteExecutorUseCase>(BuckconfigKeyRef {
744744
section: "buck2_re_client",

tests/core/build/test_critical_path.py

+4-24
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class critical_path_log:
3131
potential_improvement_duration: str
3232

3333

34-
async def do_critical_path(buck: Buck, correct_analysis: bool) -> None:
34+
async def do_critical_path(buck: Buck) -> None:
3535
await buck.build("//:step_3", "--no-remote-cache")
3636

3737
critical_path = (await buck.log("critical-path")).stdout.strip().splitlines()
@@ -57,13 +57,7 @@ async def do_critical_path(buck: Buck, correct_analysis: bool) -> None:
5757
("materialization", "root//:step_3"),
5858
("compute-critical-path", ""),
5959
]
60-
if correct_analysis:
61-
assert len(critical_path) == len(expected)
62-
else:
63-
# If correct_analysis = False (i.e. backend is the default), analysis nodes are not handled properly.
64-
# There is now non-determinism in this test since what we get back depends on
65-
# where the analysis becomes the longest path.
66-
assert len(trimmed_critical_path) > 0
60+
assert len(critical_path) == len(expected)
6761

6862
for s, e in zip(reversed(trimmed_critical_path), reversed(expected)):
6963
if s.kind == "action":
@@ -72,23 +66,16 @@ async def do_critical_path(buck: Buck, correct_analysis: bool) -> None:
7266
else:
7367
assert s.execution_kind == ""
7468

75-
if not correct_analysis and s.kind == "analysis":
76-
break
7769
assert s.kind == e[0]
7870
assert s.name == e[1]
7971

8072

81-
@buck_test()
82-
async def test_critical_path(buck: Buck) -> None:
83-
await do_critical_path(buck, False)
84-
85-
8673
@buck_test()
8774
async def test_critical_path_longest_path_graph(buck: Buck) -> None:
8875
with open(buck.cwd / ".buckconfig", "a") as f:
8976
f.write("[buck2]\n")
9077
f.write("critical_path_backend2 = longest-path-graph\n")
91-
await do_critical_path(buck, True)
78+
await do_critical_path(buck)
9279

9380

9481
@buck_test()
@@ -103,7 +90,6 @@ async def test_critical_path_json(buck: Buck) -> None:
10390
)
10491
critical_path = [json.loads(e) for e in critical_path]
10592

106-
assert len(critical_path) > 0
10793
expected = [
10894
("time-spent-synchronizing-and-waiting", None),
10995
("listing", "root//"),
@@ -119,15 +105,9 @@ async def test_critical_path_json(buck: Buck) -> None:
119105
("materialization", "root//:step_3"),
120106
("compute-critical-path", None),
121107
]
108+
assert len(critical_path) == len(expected)
122109

123110
for critical, exp in zip(reversed(critical_path), reversed(expected)):
124-
if critical["kind"] == "analysis":
125-
# When the backend is the default, analysis nodes are not handled properly.
126-
# There is now non-determinism in this test since what we get back depends on
127-
# where the analysis becomes the longest path.
128-
# This is fixed when critical_path_backend2 = longest-path-graph.
129-
break
130-
131111
assert "kind" in critical
132112
assert critical["kind"] == exp[0]
133113

0 commit comments

Comments
 (0)