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

Do safe preprocess optimizations. #4444

Merged
merged 1 commit into from
Nov 26, 2024
Merged

Conversation

jonathanmetzman
Copy link
Collaborator

  1. Don't unnecessarily list features about blobs other than names
  2. Memoize leak blacklist stuff.
  3. Properly skip cleanup.

1. Don't unnecessarily list features about blobs other than names
2. Memoize leak blacklist stuff.
3. Properly skip cleanup.
@jonathanmetzman
Copy link
Collaborator Author

This has some of the changes from #4431 while I wait for a review.

@@ -80,6 +80,8 @@ class AlreadyRunningError(Error):
def cleanup_task_state():
"""Cleans state before and after a task is executed."""
# Cleanup stale processes.
if not environment.is_tworker():
Copy link
Collaborator

Choose a reason for hiding this comment

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

How bad is it if this codepath gets hit by the uworker? Why not an assertion?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I expect the codepath to be hit by both uworker and tworker (is that what you mean).
I just don't want to do the cleanup in a twoker. It's pretty slow and it's doing things a tworker doesn't need like killing processes and removing tmpdirs. tworker doesn't really need this because it's not actually running or downloading anything.

@@ -468,7 +470,6 @@ def process_command_impl(task_name, task_argument, job_name, high_end,
return run_command(task_name, task_argument, job_name, uworker_env)
finally:
# Final clean up.
if not environment.is_tworker():
cleanup_task_state()
cleanup_task_state()
Copy link
Collaborator

@vitorguidi vitorguidi Nov 26, 2024

Choose a reason for hiding this comment

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

I assume this got removed from L83, since you make sure that this code is not reached by the uworker? Is there anything other than the uworker that you want to avoid reaching this code path? Or is there any other mechanism in place that would avoid the old untrusted worker architecture to get here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sorry do you mean a different PR?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Line of code, sorry

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I find the question kind of confusing, but I'm no longer relying on that old if statement, the new one is better because the function is called from more than one place.
This doesn't really have anything to do with the untrusted arch.

Copy link
Collaborator

@vitorguidi vitorguidi left a comment

Choose a reason for hiding this comment

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

lgtm, with some clarifications

@jonathanmetzman jonathanmetzman merged commit 1ff092d into master Nov 26, 2024
7 checks passed
@jonathanmetzman jonathanmetzman deleted the uncontroversial-speed branch November 26, 2024 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants