Change in vdsm[master]: lib: allow to set system thread names
nsoffer at redhat.com
nsoffer at redhat.com
Mon May 18 11:43:35 UTC 2015
Nir Soffer has posted comments on this change.
Change subject: lib: allow to set system thread names
......................................................................
Patch Set 2:
(4 comments)
https://gerrit.ovirt.org/#/c/41052/2/lib/vdsm/threadname.py
File lib/vdsm/threadname.py:
Line 32: try:
Line 33: _pthread_setname_np = _pthread_setname_np_proto(('pthread_setname_np',
Line 34: LIBPTHREAD))
Line 35: except AttributeError:
Line 36: _pthread_setname_np = None
Lets log a warning *once* if pthread_setname_np is not available, and initialize this to:
def _pthread_setname_np(thread, name):
pass
I don't see any value in raising RuntimeError on platform where this feature is not available.
Line 37:
Line 38:
Line 39: def set_system_name(thread, name):
Line 40: if _pthread_setname_np is None:
Line 41: raise RuntimeError("Cannot set system name for threads")
Line 42:
Line 43: ident = getattr(thread, "ident", None)
Line 44: if ident is None:
Line 45: raise RuntimeError("Cannot set system name on a thread without ident")
Is this possible?
Line 46:
Line 47: _pthread_setname_np(ident, name[:15])
Line 48:
Line 49:
Line 43: ident = getattr(thread, "ident", None)
Line 44: if ident is None:
Line 45: raise RuntimeError("Cannot set system name on a thread without ident")
Line 46:
Line 47: _pthread_setname_np(ident, name[:15])
Taking only part of the name is bad api. We should raise ValueError if the sent name is too long.
Is this limit documented?
Line 48:
Line 49:
Line 50: def systemname(name):
Line 51: """
Line 48:
Line 49:
Line 50: def systemname(name):
Line 51: """
Line 52: Decorator to set set the system name for a thread body callable.
body is not common term, I think we should use f or func instead.
We must see example usage of this on some threads in vdsm. Can you post partial patch showing how will this be used?
Line 53: The system name must be an ASCII string at most 15 characters long.
Line 54: """
Line 55: def decorator(func):
Line 56: @functools.wraps(func)
--
To view, visit https://gerrit.ovirt.org/41052
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ib96bd0471a07449d2a0a0328137e8437aefad901
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-HasComments: Yes
More information about the vdsm-patches
mailing list