Nir Soffer has posted comments on this change. Change subject: utils: Correct and faster list2cmdline ......................................................................
Patch Set 7: (1 comment) http://gerrit.ovirt.org/#/c/27548/7/lib/vdsm/utils.py File lib/vdsm/utils.py: Line 731: Line 732: if not printable: Line 733: printable = command Line 734: Line 735: execCmdLogger.debug("%s (cwd %s)", _list2cmdline(printable), cwd) > Even though the new function is a significant improvement I suggest we add: Sure we can, but using this all over the code is little ugly. How about something more general that we can reuse a lot: class LazyString(object): __slots__ = ("func", "args", "kwargs") def __init__(self, func, *args, **kwargs): self.func = func self.args = args self.kwargs = kwargs def __str__(self): return self.func(*args, **kwargs) So now this becomes: cmdline = LazyString(_list2cmdline, printable) execCmdLogger.debug("%s (cwd %s)", cmdline, cwd) Not sure about the LazyString, just the first name that I could think about. Line 736: Line 737: p = CPopen(command, close_fds=True, cwd=cwd, env=env, Line 738: deathSignal=deathSignal, childUmask=childUmask) Line 739: if not sync: -- To view, visit http://gerrit.ovirt.org/27548 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ibfc7819c126fe51cc068cc6f9f85b1002878385b Gerrit-PatchSet: 7 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer <[email protected]> Gerrit-Reviewer: Adam Litke <[email protected]> Gerrit-Reviewer: Allon Mureinik <[email protected]> Gerrit-Reviewer: Dan Kenigsberg <[email protected]> Gerrit-Reviewer: Federico Simoncelli <[email protected]> Gerrit-Reviewer: Nir Soffer <[email protected]> Gerrit-Reviewer: Saggi Mizrahi <[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
