Skip to content

Commit

Permalink
Minor clean ups (pep8 etc)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jahaja committed Mar 9, 2014
1 parent 5c25ca7 commit f270376
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
1 change: 0 additions & 1 deletion psdash/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,3 @@ def get(self, filename, key=None):
return self.create(filename, key)
else:
return self.readers.get(reader_key)

5 changes: 2 additions & 3 deletions psdash/net.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
ifreq = struct.Struct("16sH2xI16x")

ifconf = struct.Struct("iL")



class NetIOCounters(object):
_last_req = None
_last_req_time = None
Expand Down Expand Up @@ -85,5 +86,3 @@ def get_network_interfaces(max_net_inf=10):
interfaces.append(inf)

return interfaces


13 changes: 6 additions & 7 deletions psdash/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

logs = Logs()


def get_disks(all_partitions=False):
disks = [
(dp, psutil.disk_usage(dp.mountpoint))
Expand Down Expand Up @@ -88,6 +89,7 @@ def setup_client_id():

@app.errorhandler(404)
def page_not_found(e):
app.logger.debug("Client tried to load an unknown route: %s", e)
return render_template("error.html", error="Page not found."), 404


Expand Down Expand Up @@ -233,7 +235,7 @@ def process(pid, section):


@app.route("/network")
def network():
def view_networks():
netifs = get_network_interfaces()
netifs.sort(key=lambda x: x["bytes_sent"], reverse=True)
return render_template(
Expand All @@ -245,7 +247,7 @@ def network():


@app.route("/disks")
def disks():
def view_disks():
disks = get_disks(all_partitions=True)
io_counters = psutil.disk_io_counters(perdisk=True).items()
io_counters.sort(key=lambda x: x[1].read_count, reverse=True)
Expand Down Expand Up @@ -347,7 +349,7 @@ def search_log():

def parse_args():
parser = argparse.ArgumentParser(
description="psdash %s - system information web dashboard" % ("0.1.0")
description="psdash %s - system information web dashboard" % "0.1.0"
)
parser.add_argument(
"-l", "--log",
Expand Down Expand Up @@ -383,6 +385,7 @@ def parse_args():

return parser.parse_args()


def main():
args = parse_args()
for log in args.logs:
Expand All @@ -398,7 +401,3 @@ def main():

if __name__ == '__main__':
main()




1 change: 0 additions & 1 deletion tests/log_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,5 @@ def test_searching_other_buffer_size(self):
self.assertListEqual(self.POSITIONS, positions)



if __name__ == "__main__":
unittest.main()

0 comments on commit f270376

Please sign in to comment.