-
Notifications
You must be signed in to change notification settings - Fork 290
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
Fixes for teuthology-node-cleanup #1949
Conversation
Also fix the return type and docstring, which were inconsistent. Signed-off-by: Zack Cerza <[email protected]>
Some context as to why you are fixing this in the PR description would be super helpful, thanks! |
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.
Other than the minor comment, LGTM
scripts/node_cleanup.py
Outdated
owner_nodes = by_owner.setdefault(node['locked_by'], []) | ||
owner_nodes.append(node) |
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.
I know that owner_nodes is a reference to by_owner, can't we just purely use by_owner? Am I missing something?
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.
by_owner
is a dict where keys are e.g. "scheduled_zack@teuthology", and values are lists of dicts containing node data, whereas owner_nodes
is a reference to one of those lists - but you're right that there's no real point in holding this reference.
I'll replace the above two lines with:
by_owner.setdefault(node['locked_by'], []).append(node)
Signed-off-by: Zack Cerza <[email protected]>
Signed-off-by: Zack Cerza <[email protected]>
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, thanks for addressing the comment
This mainly gets the command working without having to invoke with
--owner
for each user who has jobs running.