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

API for extension cgroups #1533

Merged
merged 3 commits into from
May 21, 2019
Merged

Conversation

narrieta
Copy link
Member

@narrieta narrieta commented May 20, 2019

Description

Completed API for managing extension cgroups


PR information

  • The title of the PR is clear and informative.
  • There are a small number of commits, each of which has an informative message. This means that previously merged commits do not appear in the history of the PR. For information on cleaning up the commits in your pull request, see this page.
  • Except for special cases involving multiple contributors, the PR is started from a fork of the main repository, not a branch.
  • If applicable, the PR references the bug/issue that it fixes in the description.
  • New Unit tests were added for the changes made and Travis.CI is passing.

Quality of Code and Contribution Guidelines


This change is Reviewable

@codecov
Copy link

codecov bot commented May 20, 2019

Codecov Report

Merging #1533 into cgroups will decrease coverage by 0.2%.
The diff coverage is 39.13%.

Impacted file tree graph

@@             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
Impacted Files Coverage Δ
azurelinuxagent/common/cgroupapi.py 30.97% <21.81%> (-3.36%) ⬇️
azurelinuxagent/common/cgroupconfigurator.py 36.46% <54.16%> (-0.01%) ⬇️
azurelinuxagent/ga/exthandlers.py 81.54% <84.61%> (+0.11%) ⬆️
azurelinuxagent/common/cgroupstelemetry.py 30.64% <0%> (-1.62%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ab8f394...a99463a. Read the comment docs.

Copy link
Contributor

@pgombar pgombar left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -81,45 +88,121 @@ def _foreach_controller(operation, message):
else:
operation(controller)

def _get_extension_cgroups_root_path(self, controller):
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be static.

Copy link
Member Author

Choose a reason for hiding this comment

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

done


return os.path.join(extensions_root, cgroup_name)

def _add_process_to_cgroup(self, pid, cgroup_path):
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be static.

Copy link
Member Author

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))
Copy link
Contributor

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"

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

@@ -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")
Copy link
Contributor

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

yup

@@ -38,6 +39,12 @@ def create_agent_cgroups(self):
def create_extension_cgroups_root(self):
raise NotImplementedError()

def create_extension_cgroups(self):
Copy link
Contributor

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

thank you, fixed

@narrieta
Copy link
Member Author

@pgombar thanks for the review, could you check the updates in the last commit? thanks

@narrieta narrieta merged commit 8d02446 into Azure:cgroups May 21, 2019
@narrieta narrieta deleted the extension_cgroups branch May 21, 2019 19:00
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