SERVER-117189: Intermediate targets fail to run if they use cpu tags (#46446)
GitOrigin-RevId: 6f2696c426afd48337f3bb8857274bed2e9e0eb2
This commit is contained in:
committed by
MongoDB Bot
parent
7b24888277
commit
2887738503
@@ -710,7 +710,14 @@ def _mongo_cc_binary_and_test(
|
||||
# we dont want the intermediate build targets to be picked up by tags
|
||||
# so we empty it out
|
||||
original_tags = list(args["tags"])
|
||||
args["tags"] = ["intermediate_debug"] + [tag + "_debug" for tag in original_tags]
|
||||
args["tags"] = ["intermediate_debug"] + [
|
||||
tag + "_debug" if
|
||||
# Transformations via `test_exec_properties` have already been applied at this point.
|
||||
# Need to leave cpu tags unchanged, since more parsing validation is done deeper in bazel.
|
||||
not tag.startswith(("resources:cpu:", "cpu:")) else tag
|
||||
for tag in original_tags
|
||||
]
|
||||
|
||||
if _program_type == "binary":
|
||||
cc_binary(**args)
|
||||
extract_debuginfo_binary(
|
||||
|
||||
@@ -46,6 +46,17 @@ def _choose_pool(pools, cpus):
|
||||
fail("Requested {cpus} CPUs by tag 'cpu:{cpus}', but there is no remote execution pool that can satisfy this.".format(cpus = cpus))
|
||||
|
||||
def test_exec_properties(tags):
|
||||
"""Returns execution properties for selecting the appropriate remote execution pool based on CPU requirements.
|
||||
|
||||
Args:
|
||||
tags: A list of tags that may include CPU resource requirements (e.g., 'cpu:2').
|
||||
|
||||
Returns:
|
||||
A select() statement that maps platform configurations to execution properties,
|
||||
or an empty dict if no CPU tags are found.
|
||||
|
||||
Tags themselves are not modified.
|
||||
"""
|
||||
cpus = _parse_cpu_tag(tags)
|
||||
if not cpus:
|
||||
return {}
|
||||
|
||||
@@ -57,6 +57,7 @@ mongo_cc_unit_test(
|
||||
srcs = ["visibility_test1.cpp"],
|
||||
provides_main = True,
|
||||
tags = [
|
||||
"cpu:2",
|
||||
"mongo_unittest_third_group",
|
||||
"server-programmability",
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user