Let actions run on a worker, now that there is something to send
Both compilers are dependencies, so an action carries what it needs to run somewhere else. //platforms:remote is //platforms:cache with dispatch allowed and the worker named; the cache-only platform stays, because a toolchain that is not hermetic is a thing this repo could acquire again by accident, and the two differ by one attribute. The executor image is named explicitly rather than left to the default. The default is old enough that buck2's own prelude tools do not run on it: they are Python, they subscript builtin types, and 3.8 does not. That failure is also how remote execution was confirmed to work at all — the traceback came back from a worker. Confirmed by what-ran reporting re(...) with a digest against every action of a build, the toolchain archives among them. Those fetch on the worker, from upstream, rather than being pushed there from here. Left alone for now: the linker still runs locally whatever the platform says, because link_binaries_locally and archive_objects_locally are set on the C toolchain. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
5a37b4b parent: 6391496 modified
platforms/BUCK +15 -0 | @@ -13,3 +13,18 @@ execution_platform( | ||
| 13 | 13 | use_windows_path_separators = host_info().os.is_windows, |
| 14 | 14 | visibility = ["PUBLIC"], |
| 15 | 15 | ) |
| 16 | + | |
| 17 | +# The same platform, allowed to dispatch. The properties name the worker to run | |
| 18 | +# on; BuildBuddy matches an action against its executor pool by these. | |
| 19 | +execution_platform( | |
| 20 | + name = "remote", | |
| 21 | + cpu_configuration = host_configuration.cpu, | |
| 22 | + os_configuration = host_configuration.os, | |
| 23 | + remote_enabled = True, | |
| 24 | + remote_execution_properties = { | |
| 25 | + "OSFamily": "Linux", | |
| 26 | + "container-image": "docker://gcr.io/flame-public/rbe-ubuntu22-04:latest", | |
| 27 | + }, | |
| 28 | + use_windows_path_separators = host_info().os.is_windows, | |
| 29 | + visibility = ["PUBLIC"], | |
| 30 | +) | |
| @@ -13,3 +13,18 @@ execution_platform( | |||
| 13 | use_windows_path_separators = host_info().os.is_windows, | 13 | use_windows_path_separators = host_info().os.is_windows, |
| 14 | visibility = ["PUBLIC"], | 14 | visibility = ["PUBLIC"], |
| 15 | ) | 15 | ) |
| 16 | + | ||
| 17 | +# The same platform, allowed to dispatch. The properties name the worker to run | ||
| 18 | +# on; BuildBuddy matches an action against its executor pool by these. | ||
| 19 | +execution_platform( | ||
| 20 | + name = "remote", | ||
| 21 | + cpu_configuration = host_configuration.cpu, | ||
| 22 | + os_configuration = host_configuration.os, | ||
| 23 | + remote_enabled = True, | ||
| 24 | + remote_execution_properties = { | ||
| 25 | + "OSFamily": "Linux", | ||
| 26 | + "container-image": "docker://gcr.io/flame-public/rbe-ubuntu22-04:latest", | ||
| 27 | + }, | ||
| 28 | + use_windows_path_separators = host_info().os.is_windows, | ||
| 29 | + visibility = ["PUBLIC"], | ||
| 30 | +) | ||
modified
platforms/defs.bzl +11 -7 | @@ -5,11 +5,10 @@ | ||
| 5 | 5 | # its CommandExecutorConfig changed. Everything else mirrors the original |
| 6 | 6 | # exactly, so this platform stays configuration-identical to the default. |
| 7 | 7 | # |
| 8 | -# Cache only, never remote execution. The toolchain in toolchains/BUCK points | |
| 9 | -# at absolute paths inside this checkout (see the note there about os.execl), | |
| 10 | -# which no RE worker will have. `remote_enabled = False` is the switch that | |
| 11 | -# says so; the cache is read and written over the network regardless, and | |
| 12 | -# every action still runs locally. | |
| 8 | +# Whether actions may run on a worker is an attribute now rather than a | |
| 9 | +# constant. It was false because it had to be: the toolchain named absolute | |
| 10 | +# paths inside this checkout, which no worker would have. Both compilers are | |
| 11 | +# dependencies now, so there is something to ship. | |
| 13 | 12 | load("@prelude//cfg/exec_platform:marker.bzl", "get_exec_platform_marker") |
| 14 | 13 | |
| 15 | 14 | def _execution_platform_impl(ctx: AnalysisContext) -> list[Provider]: |
| @@ -23,10 +22,12 @@ def _execution_platform_impl(ctx: AnalysisContext) -> list[Provider]: | ||
| 23 | 22 | label = name, |
| 24 | 23 | configuration = cfg, |
| 25 | 24 | executor_config = CommandExecutorConfig( |
| 26 | - local_enabled = True, | |
| 27 | - remote_enabled = False, | |
| 25 | + local_enabled = ctx.attrs.local_enabled, | |
| 26 | + remote_enabled = ctx.attrs.remote_enabled, | |
| 28 | 27 | remote_cache_enabled = True, |
| 29 | 28 | allow_cache_uploads = True, |
| 29 | + remote_execution_properties = ctx.attrs.remote_execution_properties, | |
| 30 | + remote_execution_use_case = "buck2-default", | |
| 30 | 31 | use_windows_path_separators = ctx.attrs.use_windows_path_separators, |
| 31 | 32 | ), |
| 32 | 33 | ) |
| @@ -45,6 +46,9 @@ execution_platform = rule( | ||
| 45 | 46 | impl = _execution_platform_impl, |
| 46 | 47 | attrs = { |
| 47 | 48 | "cpu_configuration": attrs.dep(providers = [ConfigurationInfo]), |
| 49 | + "local_enabled": attrs.bool(default = True), | |
| 50 | + "remote_enabled": attrs.bool(default = False), | |
| 51 | + "remote_execution_properties": attrs.dict(attrs.string(), attrs.string(), default = {}), | |
| 48 | 52 | "os_configuration": attrs.dep(providers = [ConfigurationInfo]), |
| 49 | 53 | "use_windows_path_separators": attrs.bool(), |
| 50 | 54 | }, |
| @@ -5,11 +5,10 @@ | |||
| 5 | # its CommandExecutorConfig changed. Everything else mirrors the original | 5 | # its CommandExecutorConfig changed. Everything else mirrors the original |
| 6 | # exactly, so this platform stays configuration-identical to the default. | 6 | # exactly, so this platform stays configuration-identical to the default. |
| 7 | # | 7 | # |
| 8 | -# Cache only, never remote execution. The toolchain in toolchains/BUCK points | 8 | +# Whether actions may run on a worker is an attribute now rather than a |
| 9 | -# at absolute paths inside this checkout (see the note there about os.execl), | 9 | +# constant. It was false because it had to be: the toolchain named absolute |
| 10 | -# which no RE worker will have. `remote_enabled = False` is the switch that | 10 | +# paths inside this checkout, which no worker would have. Both compilers are |
| 11 | -# says so; the cache is read and written over the network regardless, and | 11 | +# dependencies now, so there is something to ship. |
| 12 | -# every action still runs locally. | ||
| 13 | load("@prelude//cfg/exec_platform:marker.bzl", "get_exec_platform_marker") | 12 | load("@prelude//cfg/exec_platform:marker.bzl", "get_exec_platform_marker") |
| 14 | 13 | ||
| 15 | def _execution_platform_impl(ctx: AnalysisContext) -> list[Provider]: | 14 | def _execution_platform_impl(ctx: AnalysisContext) -> list[Provider]: |
| @@ -23,10 +22,12 @@ def _execution_platform_impl(ctx: AnalysisContext) -> list[Provider]: | |||
| 23 | label = name, | 22 | label = name, |
| 24 | configuration = cfg, | 23 | configuration = cfg, |
| 25 | executor_config = CommandExecutorConfig( | 24 | executor_config = CommandExecutorConfig( |
| 26 | - local_enabled = True, | 25 | + local_enabled = ctx.attrs.local_enabled, |
| 27 | - remote_enabled = False, | 26 | + remote_enabled = ctx.attrs.remote_enabled, |
| 28 | remote_cache_enabled = True, | 27 | remote_cache_enabled = True, |
| 29 | allow_cache_uploads = True, | 28 | allow_cache_uploads = True, |
| 29 | + remote_execution_properties = ctx.attrs.remote_execution_properties, | ||
| 30 | + remote_execution_use_case = "buck2-default", | ||
| 30 | use_windows_path_separators = ctx.attrs.use_windows_path_separators, | 31 | use_windows_path_separators = ctx.attrs.use_windows_path_separators, |
| 31 | ), | 32 | ), |
| 32 | ) | 33 | ) |
| @@ -45,6 +46,9 @@ execution_platform = rule( | |||
| 45 | impl = _execution_platform_impl, | 46 | impl = _execution_platform_impl, |
| 46 | attrs = { | 47 | attrs = { |
| 47 | "cpu_configuration": attrs.dep(providers = [ConfigurationInfo]), | 48 | "cpu_configuration": attrs.dep(providers = [ConfigurationInfo]), |
| 49 | + "local_enabled": attrs.bool(default = True), | ||
| 50 | + "remote_enabled": attrs.bool(default = False), | ||
| 51 | + "remote_execution_properties": attrs.dict(attrs.string(), attrs.string(), default = {}), | ||
| 48 | "os_configuration": attrs.dep(providers = [ConfigurationInfo]), | 52 | "os_configuration": attrs.dep(providers = [ConfigurationInfo]), |
| 49 | "use_windows_path_separators": attrs.bool(), | 53 | "use_windows_path_separators": attrs.bool(), |
| 50 | }, | 54 | }, |