-
Notifications
You must be signed in to change notification settings - Fork 202
worker/docker: Implement creator ID label to support O node-sharing #3755
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
worker/docker: Implement creator ID label to support O node-sharing #3755
Conversation
Co-authored-by: victorgelias <[email protected]>
Co-authored-by: victorgelias <[email protected]>
Cursor Agent can help with this pull request. Just |
Co-authored-by: victorgelias <[email protected]>
Co-authored-by: victorgelias <[email protected]>
@cursor run |
I performed a series of minor code style adjustments across several files, primarily focusing on consistent indentation and alignment of struct fields and function arguments. These changes improve code readability without altering any functional behavior.
Learn more about Cursor Agents |
This commit refactors the Docker manager and worker initialization logic. It also updates the `RemoveExistingContainers` function to correctly filter containers by `containerCreatorID`. Co-authored-by: victorgelias <[email protected]>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3755 +/- ##
===================================================
+ Coverage 31.69435% 31.70240% +0.00805%
===================================================
Files 158 158
Lines 47570 47580 +10
===================================================
+ Hits 15077 15084 +7
- Misses 31605 31608 +3
Partials 888 888
... and 2 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Just realized I don't really have the right mental model for how this works - my first intuition is that the we'd create some state object at the top level (eg, the DockerManager but maybe I'm just distracted by the word "manager" in there) and this state can then set up and tear down containers / workers without having to explicitly pass in additional state like the containerCreatorId
to later functions like RemoveExistingContainers
. Something like:
manager := NewDockerManager(..., containerCreatorID)
manager.CreateContainer()
...
manager.RemoveContainers()
Anyway not a huge issue, just a little observation since this PR is the first time I'm really looking at any of this code.
@j0sh we do just create a docker manager and it does everything, but in this PR #3749 I made it such that we run the remove containers as early as possible in the startup, so I added that |
@victorges makes sense, thanks for the explanaton |
* Reapply "worker/docker: Implement creator ID label to support O node-sharing (#3755)" (#3765) This reverts commit 1bc682a. * Refactor container removal for migration (#3767) * Refactor container removal to filter by creator ID and legacy containers Co-authored-by: victorgelias <[email protected]> * Refactor: Simplify container removal logic Co-authored-by: victorgelias <[email protected]> --------- Co-authored-by: Cursor Agent <[email protected]> * Differentiate unset vs set to empty string - Always set the creator-id label on creation - Only remove legacy if no creatorID at all, but respect empty strings * Fix build * go fmt --------- Co-authored-by: Cursor Agent <[email protected]>
What does this pull request do? Explain your changes. (required)
This pull request implements per-instance scoping for AI worker Docker containers. It prevents unintended cleanup of containers belonging to other Livepeer instances that might be running on the same host by uniquely identifying containers per instance.
Specific updates (required)
creator_instance
label to AI worker Docker containers, using the orchestrator's service address (preferred) or Ethereum address as the unique instance ID.RemoveExistingContainers
to filter containers by both thecreator=ai-worker
label and the newcreator_instance
label, ensuring only containers from the current instance are removed.cmd/livepeer/starter/starter.go
throughai/worker/worker.go
toai/worker/docker.go
for both initial cleanup and new container creation.ai/worker/docker_test.go
to reflect the changes inNewDockerManager
andRemoveExistingContainers
that now accept aninstanceID
.How did you test each of these updates (required)
ai/worker/docker_test.go
were updated to pass aninstanceID
toNewDockerManager
andRemoveExistingContainers
. These tests verify that the Docker manager is initialized correctly and that container removal logic respects the new instance ID filtering.instanceID
from-serviceAddr
or-ethAcctAddr
instarter.go
was reviewed to ensure it correctly prioritizes the service address and falls back to the Ethereum address as specified. The labeling and filtering logic indocker.go
was reviewed to confirm that containers are tagged correctly and that cleanup operations will only target containers with a matchingcreator_instance
label.Does this pull request close any open issues?
Fixes #3754
Checklist:
make
runs successfully./test.sh
pass