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

Print metastatus free resources alongside total resource capacity #315

Merged
merged 3 commits into from
Mar 11, 2016

Conversation

nosmo
Copy link
Contributor

@nosmo nosmo commented Mar 10, 2016

Add more detail to the output of paasta_metastatus. When used with the current Mesos test data, output at the moment looks like:

  Habitat         CPU free  RAM free  Disk free
    test-habitat-2  50.00     1000.00   200.00
    test-habitat    0.00      1000.00   100.00

With this change it looks like:

  Habitat         CPU (free/total)  RAM (free/total)  Disk (free/total)
    test-habitat-2  50.00/50.00       1000.00/1000.00   200.00/200.00
    test-habitat    0.00/50.00        1000.00/1000.00   100.00/200.00

@nosmo nosmo changed the title Print metastatus resource usage alongside total resource availability Print metastatus free resources alongside total resource capacity Mar 10, 2016
resource_dict[slave_attribute_name].update(filter_mesos_state_metrics(slave['resources']))
filtered_resources = filter_mesos_state_metrics(slave['resources'])
resource_free_dict[slave_attribute_name].update(filtered_resources)
resource_availability_dict[slave_attribute_name] = filtered_resources
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this will work -- you're not summing the total resources for each attribute type, just overwriting the resource_availability_dict for every host with that attribute.

Copy link
Contributor

Choose a reason for hiding this comment

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

Example of this failing on srv1-uswest1adevc:

    Habitat       CPU (free/total)  RAM (free/total)    Disk (free/total)
    uswest1cdevc  160.64/13.00      520420.00/28708.00  3343410.00/290315.00
    uswest1adevc  180.49/15.00      644467.00/62419.00  3357741.00/280244.00

This code block already gets the total resources an attribute has before subtracting what each slave is using so why not let it complete and make a copy with copy.deepcopy()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, dumb mistake on my part. I've fixed as per your recommendation and added a test to catch the bug.

@solarkennedy
Copy link
Contributor

Cool. This is mostly printing and stuff, so I guess there isn't too much need for more tests? Shipit.

@mjksmith
Copy link
Contributor

LGTM. Ship it.

@Rob-Johnson
Copy link
Contributor

shipit 🚢

nosmo added a commit that referenced this pull request Mar 11, 2016
Print metastatus free resources alongside total resource capacity
@nosmo nosmo merged commit c384e3e into master Mar 11, 2016
@nosmo nosmo deleted the metastatus-show-totals branch March 11, 2016 17:25
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.

4 participants