Antoni Segura Puimedon has posted comments on this change.

Change subject: core: Add boot time to the getVdsStats API
......................................................................


Patch Set 13: Code-Review-1

(2 comments)

Some minor nits (-1 for visibility).

http://gerrit.ovirt.org/#/c/25877/13/vdsm/sampling.py
File vdsm/sampling.py:

Line 156: 
Line 157:     Raises IOError if file access fails, or ValueError if boot time 
not
Line 158:     present in file.
Line 159:     """
Line 160:     with file(_PROC_STAT_PATH) as f:
'file' is deprecated and shouldn't be used. 'open' is the recommended 
replacement. It is good not to make one letter vars as well.
Line 161:         for line in f.readlines():
Line 162:             if line.startswith('btime'):
Line 163:                 parts = line.split()
Line 164:                 if len(parts) > 1:


Line 157:     Raises IOError if file access fails, or ValueError if boot time 
not
Line 158:     present in file.
Line 159:     """
Line 160:     with file(_PROC_STAT_PATH) as f:
Line 161:         for line in f.readlines():
why not just:
    for line in f
Do you need to load the whole file in memory at once?
Line 162:             if line.startswith('btime'):
Line 163:                 parts = line.split()
Line 164:                 if len(parts) > 1:
Line 165:                     return int(parts[1])


-- 
To view, visit http://gerrit.ovirt.org/25877
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I319e619cdaecac2f86d0154e3adbb3beda9c57d6
Gerrit-PatchSet: 13
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dima Kuznetsov <[email protected]>
Gerrit-Reviewer: Adam Litke <[email protected]>
Gerrit-Reviewer: Antoni Segura Puimedon <[email protected]>
Gerrit-Reviewer: Dan Kenigsberg <[email protected]>
Gerrit-Reviewer: Dima Kuznetsov <[email protected]>
Gerrit-Reviewer: Douglas Schilling Landgraf <[email protected]>
Gerrit-Reviewer: Federico Simoncelli <[email protected]>
Gerrit-Reviewer: Nir Soffer <[email protected]>
Gerrit-Reviewer: Saggi Mizrahi <[email protected]>
Gerrit-Reviewer: Tal Nisan <[email protected]>
Gerrit-Reviewer: Yaniv Bronhaim <[email protected]>
Gerrit-Reviewer: [email protected]
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to