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

feat: add requested resources info to servers endpoint #261

Merged
merged 3 commits into from
Mar 16, 2020

Conversation

lorenzo-cavazzi
Copy link
Member

@lorenzo-cavazzi lorenzo-cavazzi commented Mar 12, 2020

Add the requested resources info to the GET /servers API response. This is an example, the new part is in the attribute resources

{
  "servers": {
    "flights-tutorial-d991bad2": {
      "annotations": {
        [...]
      },
      "name": "flights-tutorial-d991bad2",
      "resources": {
        "cpu": "0.1",
        "memory": "1073741824"
      },
      "started": "2020-03-12T16:54:30.000000Z",
      "state": {
        "pod_name": "jupyter-lorenzo-2ecavazzi-2etech-flights-2dtutorial-2dd991bad2"
      },
      "status": {
        [...]
      },
      "url": "https://lorenzo.dev.renku.ch/jupyterhub/user/lorenzo.cavazzi.tech/flights-tutorial-d991bad2/"
    }
  }
}

UPDATE: It's possible to test the change in lorenzotest deplyoment: https://lorenzotest.dev.renku.ch/

fix #223

@lorenzo-cavazzi lorenzo-cavazzi requested a review from a team as a code owner March 12, 2020 17:09
@rokroskar
Copy link
Member

Thanks @lorenzo-cavazzi! I'm wondering if it would make sense to show both resource request and limit? otoh it might make the most sense to enforce both the memory and cpu requests as limits. At the moment, only the memory is enforced. Then we only need to show a single number, like you have done here.

@lorenzo-cavazzi
Copy link
Member Author

We don't get any cpu value in the limits object if we don't enforce one. Currently, we only get the memory limit and it's always equal to the request counterpart.
On the other hand, do we want to enforce cpu limits? Is there any advantage? I see how allocating extra memory may be a problem when we need to reclaim that, but for the cpu I don't see the same problem

@rokroskar
Copy link
Member

We don't get any cpu value in the limits object if we don't enforce one

yes, that was my point - maybe we should. What can happen is that one user can starve a node of CPU. CPU is a compressible resource, meaning the OS can decide to throttle it or not. If you don't enforce CPU limits, a single greedy process can take over all of the CPU on the node adversely affecting all others.

Copy link
Member

@rokroskar rokroskar left a comment

Choose a reason for hiding this comment

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

Looks good! We can decide if we need to change the CPU policy at a later point.

@lorenzo-cavazzi
Copy link
Member Author

I was going to look into enforcing the CPU limit since your argument is convincing. Should I open a different issue to keep track of that?

@rokroskar
Copy link
Member

You just need to add the CPU limit to the pod in the spawner in the same way it's done for the memory. But maybe it warrants a discussion with the others - although the decision is either: a) we hope that the current way doesn't make too many people unhappy or b) we enforce it and then document the limitations

@lorenzo-cavazzi lorenzo-cavazzi merged commit 9e233cf into master Mar 16, 2020
@lorenzo-cavazzi lorenzo-cavazzi deleted the 223-pod-annotations branch March 16, 2020 13:11
@lorenzo-cavazzi lorenzo-cavazzi added this to the sprint-2020-03-02 milestone Mar 17, 2020
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.

feat: add resource information to pod annotations
2 participants