Vered Volansky has uploaded a new change for review.
Change subject: utils: cleanup - typos, grammar and comments refinment ......................................................................
utils: cleanup - typos, grammar and comments refinment
Change-Id: I04a1c4d444f2604b66b44bb9deac7d780db04aaf Signed-off-by: Vered Volansky vvolansk@redhat.com --- M lib/vdsm/utils.py 1 file changed, 24 insertions(+), 17 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/62/22862/1
diff --git a/lib/vdsm/utils.py b/lib/vdsm/utils.py index d6c65b2..122da3e 100644 --- a/lib/vdsm/utils.py +++ b/lib/vdsm/utils.py @@ -19,7 +19,7 @@ #
""" -A module containing miscellaneous functions and classes that are user +A module containing miscellaneous functions and classes that are used plentifuly around vdsm.
.. attribute:: utils.symbolerror @@ -56,7 +56,7 @@ from cpopen import CPopen from . import constants
-# Buffsize is 1K because I tested it on some use cases and 1k was fastets. If +# Buffsize is 1K because it was tested on some use cases and 1K was fastest. If # you find this number to be a bottleneck in any way you are welcome to change # it BUFFSIZE = 1024 @@ -118,7 +118,7 @@ """ Try to remove a file.
- If the file doesn't exist is assumed that it was already removed. + If the file doesn't exist it's assumed that it was already removed. """ try: os.unlink(fileToRemove) @@ -135,7 +135,7 @@ """ Try to remove a directory and all it's contents.
- If the directory doesn't exist is assumed that it was already removed. + If the directory doesn't exist it's assumed that it was already removed. """ try: shutil.rmtree(directoryToRemove) @@ -180,7 +180,7 @@ """ Parse ``/proc/meminfo`` and return its content as a dictionary.
- For a reason unknown to me, ``/proc/meminfo`` is is sometime + For a reason unknown to me, ``/proc/meminfo`` is sometimes empty when opened. If that happens, the function retries to open it 3 times.
@@ -297,7 +297,7 @@
class AsyncProc(object): """ - AsyncProc is a funky class. It warps a standard subprocess.Popen + AsyncProc is a funky class. It wraps a standard subprocess.Popen Object and gives it super powers. Like the power to read from a stream without the fear of deadlock. It does this by always sampling all stream while waiting for data. By doing this the other process can freely @@ -440,7 +440,7 @@ try: if self._stdin.len > 0 and self._stdin.pos == 0: # Polling stdin is redundant if there is nothing to write - # trun on only if data is waiting to be pushed + # turn on only if data is waiting to be pushed self._poller.modify(self._fdin, select.EPOLLOUT)
pollres = NoIntrPoll(self._poller.poll, 1) @@ -801,12 +801,12 @@
class memoized(object): - """Decorator that caches a function's return value each time it is called. + """ + Decorator that caches a function's return value each time it is called. If called later with the same arguments, the cached value is returned, and not re-evaluated. There is no support for uncachable arguments.
Adaptation from http://wiki.python.org/moin/PythonDecoratorLibrary#Memoize - """ def __init__(self, func): self.func = func @@ -914,7 +914,7 @@ :param func: The callable to run. :param expectedException: The exception you expect to receive when the function fails. - :param tries: The number of time to try. None\0,-1 means infinite. + :param tries: The number of times to try. None\0,-1 means infinite. :param timeout: The time you want to spend waiting. This **WILL NOT** stop the method. It will just not run it if it ended after the timeout. @@ -950,10 +950,12 @@
class AsyncProcessOperation(object): def __init__(self, proc, resultParser=None): - """Wraps a running process operation. + """ + Wraps a running process operation.
resultParser should be of type callback(rc, out, err) and can return - anything or throw exceptions.""" + anything or throw exceptions. + """ self._lock = threading.Lock()
self._result = None @@ -962,17 +964,22 @@ self._proc = proc
def wait(self, timeout=None, cond=None): - """Waits until the process has exited, the timeout has been reached or - the condition has been met""" + """ + Waits until the process has exited, the timeout has been reached or + the condition has been met + """ return self._proc.wait(timeout, cond)
def stop(self): - """Stops the running operation, effectively sending a kill signal to - the process""" + """ + Stops the running operation, effectively sending a kill signal to + the process + """ self._proc.kill()
def result(self): - """Returns the result in the as a tuple of (result, error). + """ + Returns the result as a tuple of (result, error). If the operation is still running it will block until it returns.
If no resultParser has been set the default result
Vered Volansky has posted comments on this change.
Change subject: utils: cleanup - typos, grammar and comments refinment ......................................................................
Patch Set 1: Verified+1
oVirt Jenkins CI Server has posted comments on this change.
Change subject: utils: cleanup - typos, grammar and comments refinment ......................................................................
Patch Set 1: Verified-1
Build Failed
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/6468/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/5575/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/6381/ : SUCCESS
oVirt Jenkins CI Server has posted comments on this change.
Change subject: utils: cleanup - typos, grammar and comments refinment ......................................................................
Patch Set 2:
Build Successful
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/6470/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/5577/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/6383/ : SUCCESS
Nir Soffer has posted comments on this change.
Change subject: utils: cleanup - typos, grammar and comments refinment ......................................................................
Patch Set 2: Code-Review+1
I think you can verify this and publish it.
oVirt Jenkins CI Server has posted comments on this change.
Change subject: utils: cleanup - typos, grammar and comments refinement ......................................................................
Patch Set 3:
Build Successful
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/6475/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/5582/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/6388/ : SUCCESS
Nir Soffer has posted comments on this change.
Change subject: utils: cleanup - typos, grammar and comments refinement ......................................................................
Patch Set 3: Code-Review+1
Even more refined now.
oVirt Jenkins CI Server has posted comments on this change.
Change subject: utils: cleanup - typos, grammar and comments refinement ......................................................................
Patch Set 4: Verified-1
Build Failed
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/6476/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/5583/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/6389/ : SUCCESS
Allon Mureinik has posted comments on this change.
Change subject: utils: cleanup - typos, grammar and comments refinement ......................................................................
Patch Set 4: Code-Review+1
(2 comments)
.................................................... File lib/vdsm/utils.py Line 55: Line 56: from cpopen import CPopen Line 57: from . import constants Line 58: Line 59: # Buffsize is 1K because it was tested on some use cases and 1K was fastest. If Frankly, I think this is comment is useless no matter how you fix the grammar. "some use cases" gives about as much information as "this number was presented to me by David Beckham during a lucid dream" Line 60: # you find this number to be a bottleneck in any way you are welcome to change Line 61: # it Line 62: BUFFSIZE = 1024 Line 63:
Line 982: Returns the result as a tuple of (result, error). Line 983: If the operation is still running it will block until it returns. Line 984: Line 985: If no resultParser has been set the default result Line 986: is (rc, out, err) """ According to the convention you established in this patch, the trailing """ should be moved to its own line Line 987: with self._lock: Line 988: if self._result is None: Line 989: out, err = self._proc.communicate() Line 990: rc = self._proc.returncode
Nir Soffer has posted comments on this change.
Change subject: utils: cleanup - typos, grammar and comments refinement ......................................................................
Patch Set 4:
(1 comment)
.................................................... File lib/vdsm/utils.py Line 55: Line 56: from cpopen import CPopen Line 57: from . import constants Line 58: Line 59: # Buffsize is 1K because it was tested on some use cases and 1K was fastest. If +1 for using the comment suggested by Allon :-) Line 60: # you find this number to be a bottleneck in any way you are welcome to change Line 61: # it Line 62: BUFFSIZE = 1024 Line 63:
Vered Volansky has posted comments on this change.
Change subject: utils: cleanup - typos, grammar and comments refinement ......................................................................
Patch Set 4:
(2 comments)
.................................................... File lib/vdsm/utils.py Line 55: Line 56: from cpopen import CPopen Line 57: from . import constants Line 58: Line 59: # Buffsize is 1K because it was tested on some use cases and 1K was fastest. If LOL, will remove Line 60: # you find this number to be a bottleneck in any way you are welcome to change Line 61: # it Line 62: BUFFSIZE = 1024 Line 63:
Line 982: Returns the result as a tuple of (result, error). Line 983: If the operation is still running it will block until it returns. Line 984: Line 985: If no resultParser has been set the default result Line 986: is (rc, out, err) """ yep, that wasn't supposed to be so. Line 987: with self._lock: Line 988: if self._result is None: Line 989: out, err = self._proc.communicate() Line 990: rc = self._proc.returncode
oVirt Jenkins CI Server has posted comments on this change.
Change subject: utils: cleanup - typos, grammar and comments refinement ......................................................................
Patch Set 5: Verified-1
Build Failed
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/6480/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/5587/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/6393/ : SUCCESS
oVirt Jenkins CI Server has posted comments on this change.
Change subject: utils: cleanup - typos, grammar and comments refinement ......................................................................
Patch Set 6:
Build Successful
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/6483/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/5590/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/6396/ : SUCCESS
oVirt Jenkins CI Server has posted comments on this change.
Change subject: utils: cleanup - typos, grammar and comments refinement ......................................................................
Patch Set 7: Verified-1
Build Failed
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/6485/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/5592/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/6398/ : SUCCESS
Vered Volansky has posted comments on this change.
Change subject: utils: cleanup - typos, grammar and comments refinement ......................................................................
Patch Set 7: Verified+1
Nir Soffer has posted comments on this change.
Change subject: utils: cleanup - typos, grammar and comments refinement ......................................................................
Patch Set 7: Code-Review+1
oVirt Jenkins CI Server has posted comments on this change.
Change subject: utils: cleanup - typos, grammar and comments refinement ......................................................................
Patch Set 8:
Build Successful
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/6489/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/5596/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/6403/ : SUCCESS
Vered Volansky has posted comments on this change.
Change subject: utils: cleanup - typos, grammar and comments refinement ......................................................................
Patch Set 8: Verified+1
Rebased
Allon Mureinik has posted comments on this change.
Change subject: utils: cleanup - typos, grammar and comments refinement ......................................................................
Patch Set 8: Code-Review+1
Ayal Baron has posted comments on this change.
Change subject: utils: cleanup - typos, grammar and comments refinement ......................................................................
Patch Set 8:
(1 comment)
.................................................... File lib/vdsm/utils.py Line 55: Line 56: from cpopen import CPopen Line 57: from . import constants Line 58: Line 59: BUFFSIZE = 1024 I actually prefer having insight into where such magic numbers come from because then you know if it is safe to change them or not Line 60: Line 61: SUDO_NON_INTERACTIVE_FLAG = "-n" Line 62: Line 63: _THP_STATE_PATH = '/sys/kernel/mm/transparent_hugepage/enabled'
Nir Soffer has posted comments on this change.
Change subject: utils: cleanup - typos, grammar and comments refinement ......................................................................
Patch Set 8: Code-Review+1
Dan Kenigsberg has posted comments on this change.
Change subject: utils: cleanup - typos, grammar and comments refinement ......................................................................
Patch Set 8: Code-Review-1
(1 comment)
.................................................... File lib/vdsm/utils.py Line 55 Line 56 Line 57 Line 58 Line 59 If you find out this text too flowery, I would not mind if you write something more "boring". It should not be dropped with no explanation.
Dan Kenigsberg has posted comments on this change.
Change subject: utils: cleanup - typos, grammar and comments refinement ......................................................................
Patch Set 8:
P.s., when removing someone's code/comment, please include him as a reviewer.
oVirt Jenkins CI Server has posted comments on this change.
Change subject: utils: cleanup - typos, grammar and comments refinement ......................................................................
Patch Set 9: Verified-1
Build Failed
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/6582/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/5689/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/6495/ : SUCCESS
oVirt Jenkins CI Server has posted comments on this change.
Change subject: utils: cleanup - typos, grammar and comments refinement ......................................................................
Patch Set 10: Verified-1
Build Failed
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/6585/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/5692/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/6498/ : SUCCESS
oVirt Jenkins CI Server has posted comments on this change.
Change subject: utils: cleanup - typos, grammar and comments refinement ......................................................................
Patch Set 11: Verified-1
Build Failed
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/6612/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/5719/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/6526/ : SUCCESS
Vered Volansky has posted comments on this change.
Change subject: utils: cleanup - typos, grammar and comments refinement ......................................................................
Patch Set 11: Verified+1
Rebased.
oVirt Jenkins CI Server has posted comments on this change.
Change subject: utils: cleanup - typos, grammar and comments refinement ......................................................................
Patch Set 12:
Build Successful
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/6616/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/5723/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/6529/ : SUCCESS
Vered Volansky has posted comments on this change.
Change subject: utils: cleanup - typos, grammar and comments refinement ......................................................................
Patch Set 12: Verified+1
Nir Soffer has posted comments on this change.
Change subject: utils: cleanup - typos, grammar and comments refinement ......................................................................
Patch Set 12: Code-Review+1
Yaniv Bronhaim has posted comments on this change.
Change subject: utils: cleanup - typos, grammar and comments refinement ......................................................................
Patch Set 12: Code-Review+1
Dan Kenigsberg has posted comments on this change.
Change subject: utils: cleanup - typos, grammar and comments refinement ......................................................................
Patch Set 12: Code-Review+2
Dan Kenigsberg has submitted this change and it was merged.
Change subject: utils: cleanup - typos, grammar and comments refinement ......................................................................
utils: cleanup - typos, grammar and comments refinement
Change-Id: I04a1c4d444f2604b66b44bb9deac7d780db04aaf Signed-off-by: Vered Volansky vvolansk@redhat.com Reviewed-on: http://gerrit.ovirt.org/22862 Reviewed-by: Nir Soffer nsoffer@redhat.com Reviewed-by: Yaniv Bronhaim ybronhei@redhat.com Reviewed-by: Dan Kenigsberg danken@redhat.com --- M lib/vdsm/utils.py 1 file changed, 26 insertions(+), 18 deletions(-)
Approvals: Nir Soffer: Looks good to me, but someone else must approve Yaniv Bronhaim: Looks good to me, but someone else must approve Dan Kenigsberg: Looks good to me, approved Vered Volansky: Verified
vdsm-patches@lists.fedorahosted.org