Skip to content

Conversation

@oquenchil
Copy link
Contributor

Test actions create a _tmp directory that doesn't make sense to stash between different test actions when using --reuse_sandbox_directories. This change makes sure that doesn't happen by deleting the directory before stashing.

@oquenchil oquenchil requested a review from fmeum February 19, 2024 14:31
@github-actions github-actions bot added team-Local-Exec Issues and PRs for the Execution (Local) team awaiting-review PR is awaiting review from an assigned reviewer labels Feb 19, 2024
}
path.getChild("execroot").renameTo(stashPathExecroot);
if (isTestAction(mnemonic)) {
// We only do this after the rename operation has succeeded
Copy link
Collaborator

@fmeum fmeum Feb 19, 2024

Choose a reason for hiding this comment

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

Not related to a change made in this PR, but the usage of synchronized in line 136 looks unnecessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

stashPath.createDirectory();
Path stashPathExecroot = stashPath.getChild("execroot");
if (isTestAction(mnemonic)) {
treeDeleter.deleteTree(path.getRelative("execroot/" + environment.get("TEST_WORKSPACE") + "/_tmp"));
Copy link
Collaborator

Choose a reason for hiding this comment

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

This makes it so that the containing method may now perform relatively costly IO. Is this clearly fine for the callers, for example because they would clean out the entire sandbox if it weren't reused?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As far as I can tell this would indeed get more expensive for the caller here when async deletion is disabled (when it's enabled, there's no significant cost). It also doesn't mean that sync deletion had no cost before this change, it was just paid somewhere else when cleaning up that directory during reuse.

I don't think this matters much but please correct me if I'm wrong.

@oquenchil
Copy link
Contributor Author

Thank you Fabian.

@github-actions github-actions bot removed the awaiting-review PR is awaiting review from an assigned reviewer label Feb 20, 2024
oquenchil added a commit that referenced this pull request Feb 20, 2024
Test actions create a `_tmp` directory that doesn't make sense to stash between different test actions when using `--reuse_sandbox_directories`. This change makes sure that doesn't happen by deleting the directory before stashing.

Closes #21412.

Fixes #21253.

PiperOrigin-RevId: 608566281
Change-Id: I7186f8e5eba7b3110b10963df69ec66cd1402b2c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team-Local-Exec Issues and PRs for the Execution (Local) team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants