Skip to content

Add a test for platform(exec_properties={"no-remote-exec": "true"})#22363

Closed
EdSchouten wants to merge 1 commit intobazelbuild:masterfrom
EdSchouten:eschouten/20240513-supports-remote-execution
Closed

Add a test for platform(exec_properties={"no-remote-exec": "true"})#22363
EdSchouten wants to merge 1 commit intobazelbuild:masterfrom
EdSchouten:eschouten/20240513-supports-remote-execution

Conversation

@EdSchouten
Copy link
Copy Markdown
Contributor

@EdSchouten EdSchouten commented May 14, 2024

Apparently platform(exec_properties) propagates to ctx.actions.run(execution_requirements). This means that it is possible to mark entire platforms as "no-remote-exec".

Let's add some testing coverage for this, to make sure it continues to work going forward.

@EdSchouten EdSchouten requested review from a team as code owners May 14, 2024 12:32
@EdSchouten EdSchouten requested review from katre and removed request for a team May 14, 2024 12:32
@github-actions github-actions Bot added team-Performance Issues for Performance teams team-Configurability platforms, toolchains, cquery, select(), config transitions team-Remote-Exec Issues and PRs for the Execution (Remote) team awaiting-review PR is awaiting review from an assigned reviewer labels May 14, 2024
@EdSchouten EdSchouten force-pushed the eschouten/20240513-supports-remote-execution branch 2 times, most recently from 4f1602a to b8cf829 Compare May 14, 2024 14:19
@katre
Copy link
Copy Markdown
Collaborator

katre commented May 14, 2024

I absolutely understand and support the desire behind this, but adding a new exec-related attribute to platform just makes future problems with updating the API. In specific, this because removing legacy attributes is complicated and largely impossible: witness the fact that remote_execution_properties still exists.

I see that Spawns.mayBeExecutedRemotely is checking for the "no-remote-exec" in the execution info, is that correct?

Theoretically, we're already copying data from platform.execution_properties to the execution info, but the logic is complicated and so it might not be mapping properly. However, I think that we should be able to support the following:

platform(
    name = "not_remote",
    exec_properties = {
        "no-remote-exec": "true",
    },
)

While admittedly not as clear as your new attribute, and definitely harder to discover and use, this is much better for our future plans for platforms and exec platforms (in addition to Platform-Scoped Spawn Strategies, see the original Execution Platforms vs Strategies, and the discussions in #22000 and the discussion about Selectively Enabling Execution Platforms).

Can you test out my suggestion, to see if it works? If it doesn't, and you can adapt your test from this PR, I can debug to figure out why it doesn't.

@katre
Copy link
Copy Markdown
Collaborator

katre commented May 14, 2024

As a side note, I am a bit surprised by the test failure you're seeing in CI, and I don't think it's related to your PR specifically.

@EdSchouten
Copy link
Copy Markdown
Contributor Author

EdSchouten commented May 14, 2024

I see that Spawns.mayBeExecutedRemotely is checking for the "no-remote-exec" in the execution info, is that correct?

It checks for no-remote-exec in execution_requirements.

Theoretically, we're already copying data from platform.execution_properties to the execution info, but the logic is complicated and so it might not be mapping properly. However, I think that we should be able to support the following:

platform(
    name = "not_remote",
    exec_properties = {
        "no-remote-exec": "true",
    },
)

exec_properties is different from execution_requirements, right? The former contains key/values that get passed along to REv2's platform properties (e.g., "OSFamily" = "linux"). The latter contains thinks like no-remote, no-remote-exec, no-cache, etc.. Even though they are similarly named, they are in no way related/interchangeable to each other, right?

@EdSchouten
Copy link
Copy Markdown
Contributor Author

exec_properties is different from execution_requirements, right? The former contains key/values that get passed along to REv2's platform properties (e.g., "OSFamily" = "linux"). The latter contains thinks like no-remote, no-remote-exec, no-cache, etc.. Even though they are similarly named, they are in no way related/interchangeable to each other, right?

Woah, interesting! It looks like platform(exec_properties) does propagate to ctx.actions.run(execution_requirements). How unexpected!

I've just updated this PR to remove any code changes I made. I did leave the test case behind. Maybe it's good to merge that, to ensure that this behaviour is guaranteed going forward.

Apparently platform(exec_properties) propagates to
ctx.actions.run(execution_requirements). This means that it is possible
to mark entire platforms as "no-remote-exec".

Let's add some testing coverage for this, to make sure it continues to
work going forward.
@EdSchouten EdSchouten force-pushed the eschouten/20240513-supports-remote-execution branch from b8cf829 to d4e1236 Compare May 14, 2024 18:27
@katre
Copy link
Copy Markdown
Collaborator

katre commented May 14, 2024

The trifecta of "exec properties", "exec info", and "exec requirements" are very confusing, and IMO we should collapse them into one set.

To answer your question: an exec property with a "true-ish" value (like "1" or "TRUE" or "yes") has the key added to the exec info and requirements. I wanted to convert key/values like "remote-exec": "no" to "no-remote-exec", but that was deemed too confusing and so we dropped it.

Copy link
Copy Markdown
Collaborator

@katre katre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very happy to add this test and ensure the behavior stays. Thanks for writing this, and working through the options with me!

@katre
Copy link
Copy Markdown
Collaborator

katre commented May 14, 2024

Actually, one more change: can you edit the title and description, before I put in the request to merge this?

@EdSchouten EdSchouten changed the title Add platform(supports_remote_execution=False) Add a test for platform(exec_properties={"no-remote-exec": "true"}) May 15, 2024
@EdSchouten
Copy link
Copy Markdown
Contributor Author

Actually, one more change: can you edit the title and description, before I put in the request to merge this?

Done. Thanks!

Copy link
Copy Markdown
Member

@coeuvre coeuvre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@coeuvre coeuvre added awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally and removed awaiting-review PR is awaiting review from an assigned reviewer team-Performance Issues for Performance teams labels May 15, 2024
@github-actions github-actions Bot removed the awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally label May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team-Configurability platforms, toolchains, cquery, select(), config transitions team-Remote-Exec Issues and PRs for the Execution (Remote) team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants