Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more logging to Tools/Scripts/delete-if-too-large #4574

Merged
merged 1 commit into from
Oct 19, 2022

Conversation

@@ -216,6 +216,15 @@ class PruneCoreSymbolicationdCacheIfTooLarge(shell.ShellCommand):
"/System/Library/Caches/com.apple.coresymbolicationd"]


class PruneCoreSymbolicationdDataIfTooLarge(shell.ShellCommand):
Copy link
Member

Choose a reason for hiding this comment

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

This PR is just adding the step. Need to update factory as well to invoke this step.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed. I opened the PR early to get feedback from the Python linter. Related, I implemented the most naive solution to this problem. I'm not sure how to best go about parameterising PruneCoreSymbolicationdCacheIfTooLarge within our use of buildbot.

flunkOnFailure = False
haltOnFailure = False
command = ["python3", "Tools/Scripts/delete-if-too-large",
"/System/Volumes/Data/System/Library/Caches/com.apple.coresymbolicationd"]
Copy link
Member

Choose a reason for hiding this comment

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

Running the same step/script twice just to pass two different arguments doesn't seems right. Either the script should accept multiple parameters and handle them appropriately, or the paths can be hard-coded inside the script itself.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree.

Related, I implemented the most naive solution to this problem. I'm not sure how to best go about parameterising PruneCoreSymbolicationdCacheIfTooLarge within our use of buildbot.

How can I go about parameterising PruneCoreSymbolicationdCacheIfTooLarge? It's not clear to me if we can actually (or should be )pass arguments or if the way we compose out list of steps is meant to be purely declarative.

Copy link
Member

@aj062 aj062 Sep 26, 2022

Choose a reason for hiding this comment

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

How can I go about parameterising PruneCoreSymbolicationdCacheIfTooLarge?

In steps.py for the command for PruneCoreSymbolicationdCacheIfTooLarge You can pass more arguments, just like you are passing one argument currently.

You can modify delete-if-too-large script so that users can pass multiple directories. You can either use argument parser (like https://docs.python.org/dev/library/argparse.html) or for this simple user-case, you can simply loop over sys.argv and store the arguments in a list of directories. Then just loop over that list and execute your logic to delete.

If the list of directories is going to be fixed, other option is to hard-code these directories names inside the script.

flunkOnFailure = False
haltOnFailure = False
command = ["python3", "Tools/Scripts/delete-if-too-large",
"/System/Volumes/Data/System/Library/Caches/com.apple.coresymbolicationd"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't /System/Volumes/Data/System/Library/Caches just a worse way to write /System/Library/Caches?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe it is. Though, for some reason we are seeing both of these paths needed.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that's the same directory, just linked to two places in the hierarchy in some way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's some machines in the fleet that seem to need this path for some reason.

@chgibb-apple chgibb-apple changed the title Consider More coresymbolicationd Locations Consider More coresymbolicationd locations. Refactor delete-if-too-large Sep 29, 2022
os.remove(directory)
print("Deleted " + directory)
else:
print(f'{directory} is {directorySize}. Doing nothing')
Copy link
Member

Choose a reason for hiding this comment

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

Nit: please add unit (kb/mb/gb) in this message.

Copy link
Member

Choose a reason for hiding this comment

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

this comment about adding unit is still applicable.

@aj062
Copy link
Member

aj062 commented Sep 29, 2022

Looks good to me assuming Alexey's concern about /System/Volumes/Data/System/Library/Caches and /System/Library/Caches being same is addressed.

@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Sep 29, 2022
@chgibb-apple
Copy link
Contributor Author

Thanks @aj062 . With respect to @aproskuryakov 's concern, I believe they are indeed the same folder. However, we are seeing a need for both across some machines. I can close this PR and open a new one that adds additional logging.

@chgibb-apple chgibb-apple changed the title Consider More coresymbolicationd locations. Refactor delete-if-too-large Add more logging to Tools/Scripts/delete-if-too-large Oct 4, 2022
@JonWBedard JonWBedard added unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing and removed merging-blocked Applied to prevent a change from being merged labels Oct 19, 2022
https://bugs.webkit.org/show_bug.cgi?id=245489
rdar://99293146

Reviewed by Aakash Jain.

* Tools/Scripts/delete-if-too-large:

Canonical link: https://commits.webkit.org/255737@main
@webkit-commit-queue
Copy link
Collaborator

Committed 255737@main (7380280): https://commits.webkit.org/255737@main

Reviewed commits have been landed. Closing PR #4574 and removing active labels.

@webkit-commit-queue webkit-commit-queue removed the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Oct 19, 2022
@webkit-early-warning-system webkit-early-warning-system merged commit 7380280 into WebKit:main Oct 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
7 participants