-
Notifications
You must be signed in to change notification settings - Fork 372
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
API for extension cgroups #1533
Conversation
Codecov Report
@@ Coverage Diff @@
## cgroups #1533 +/- ##
===========================================
- Coverage 61.07% 60.87% -0.21%
===========================================
Files 78 78
Lines 10919 10982 +63
Branches 1554 1555 +1
===========================================
+ Hits 6669 6685 +16
- Misses 3935 3984 +49
+ Partials 315 313 -2
Continue to review full report at Codecov.
|
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
azurelinuxagent/common/cgroupapi.py
Outdated
@@ -81,45 +88,121 @@ def _foreach_controller(operation, message): | |||
else: | |||
operation(controller) | |||
|
|||
def _get_extension_cgroups_root_path(self, controller): |
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.
This can be static.
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.
done
azurelinuxagent/common/cgroupapi.py
Outdated
|
||
return os.path.join(extensions_root, cgroup_name) | ||
|
||
def _add_process_to_cgroup(self, pid, cgroup_path): |
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.
This can be static.
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.
done
def add_to_cgroup(): | ||
self.cgroups_api.add_process_to_extension_cgroup(extension_name, os.getpid()) | ||
|
||
self._invoke_cgroup_operation(add_to_cgroup, "Failed add extension '{0}' to its cgroup; resource usage will not be tracked".format(extension_name)) |
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.
nit: "Failed add extension" -> "Failed to add extension"
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.
fixed
azurelinuxagent/ga/exthandlers.py
Outdated
@@ -822,7 +823,7 @@ def download(self): | |||
self.report_event(message="Download succeeded", duration=duration) | |||
|
|||
def initialize(self): | |||
self.logger.info("Initialize extension directory") | |||
self.logger.info("Initialize extension") |
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.
Since you're updating this, can we add the extension name here? The message seems ambiguous without it.
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.
yup
azurelinuxagent/common/cgroupapi.py
Outdated
@@ -38,6 +39,12 @@ def create_agent_cgroups(self): | |||
def create_extension_cgroups_root(self): | |||
raise NotImplementedError() | |||
|
|||
def create_extension_cgroups(self): |
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.
You're missing the parameter extension_name
in the interface signature. The implementing methods use it.
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.
thank you, fixed
@pgombar thanks for the review, could you check the updates in the last commit? thanks |
Description
Completed API for managing extension cgroups
PR information
Quality of Code and Contribution Guidelines
This change is