Nir Soffer has posted comments on this change.

Change subject: lib: allow to set system thread names
......................................................................


Patch Set 2:

(2 comments)

https://gerrit.ovirt.org/#/c/41052/2/lib/vdsm/threadname.py
File lib/vdsm/threadname.py:

Line 50: def systemname(name):
Line 51:     """
Line 52:     Decorator to set set the system name for a thread body callable.
Line 53:     The system name must be an ASCII string at most 15 characters long.
Line 54:     """
Lets check the name here and fail:

    if len(name) > 15:
        raise ValueError ...

This will fail when importing the module using the decorator.
Line 55:     def decorator(func):
Line 56:         @functools.wraps(func)
Line 57:         def wrapper(*args, **kwargs):
Line 58:             thread = threading.current_thread()


Line 57:         def wrapper(*args, **kwargs):
Line 58:             thread = threading.current_thread()
Line 59:             try:
Line 60:                 set_system_name(thread, name)
Line 61:             except RuntimeError:
> I believe we should swallow silently ValueError here, right?
Failing here is too late - we should fail when creating the decorator.

Lets not handle this as it should never fail if we filter bad names when 
creating the decorator.
Line 62:                 pass
Line 63:             return func(*args, **kwargs)
Line 64:         return wrapper


-- 
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 <from...@redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <dan...@redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimo...@redhat.com>
Gerrit-Reviewer: Francesco Romani <from...@redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer <nsof...@redhat.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybron...@redhat.com>
Gerrit-Reviewer: automat...@ovirt.org
Gerrit-HasComments: Yes
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to