Change in vdsm[master]: executor: Streamline __repr__

nsoffer at redhat.com nsoffer at redhat.com
Wed Dec 16 16:30:28 UTC 2015


Nir Soffer has uploaded a new change for review.

Change subject: executor: Streamline __repr__
......................................................................

executor: Streamline __repr__

Now that we are using self._task, we can make__repr__ in a little
bit nicer using conditional expression.

Change-Id: I0ddc1c0ebc5933ad5fad02b24cc1c32f417aa2d3
Signed-off-by: Nir Soffer <nsoffer at redhat.com>
---
M lib/vdsm/executor.py
1 file changed, 3 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/27/50627/1

diff --git a/lib/vdsm/executor.py b/lib/vdsm/executor.py
index aba904a..0a077fe 100644
--- a/lib/vdsm/executor.py
+++ b/lib/vdsm/executor.py
@@ -216,12 +216,10 @@
         self._executor._worker_discarded(self)
 
     def __repr__(self):
-        if self._task:
-            status = "running %s" % (self._task,)
-        else:
-            status = "waiting"
         return "<Worker name=%s %s%s at 0x%x>" % (
-            self.name, status, " discarded" if self._discarded else "",
+            self.name,
+            "running %s" % (self._task,) if self._task else "waiting",
+            " discarded" if self._discarded else "",
             id(self)
         )
 


-- 
To view, visit https://gerrit.ovirt.org/50627
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0ddc1c0ebc5933ad5fad02b24cc1c32f417aa2d3
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer at redhat.com>


More information about the vdsm-patches mailing list