mesosphere-backup / mesos-cli

This project has been deprecated. Please use the DC/OS CLI.
https://github.com/mesosphere/dcos-cli
Apache License 2.0
116 stars 30 forks source link

Support for resource sets with no memory #42

Closed tarnfeld closed 10 years ago

tarnfeld commented 10 years ago

Some tasks do not have memory assigned to them, this change allows support for this in the CLI. Those tasks cause the following exception...

Traceback (most recent call last):
  File "/usr/local/bin/mesos-ps", line 11, in <module>
    sys.exit(main())
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mesos/cli/cli.py", line 61, in wrapper
    return fn(*args, **kwargs)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mesos/cli/cmds/ps.py", line 82, in main
    tb.add_row([fn(task) for fn in table_generator.values()])
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mesos/cli/cmds/ps.py", line 44, in get_memory
    return "{0:.2f}".format((x.rss / max_mem) * 100)
ZeroDivisionError: float division by zero