Skip to content

Commit

Permalink
[1LP][RFR] fix slave id representation in logs (ManageIQ#9676)
Browse files Browse the repository at this point in the history
* fix slave id representation in logs

* updating requirements to the latest attr lib with repr support

* fixed a few places where repr isn't called for some reason
  • Loading branch information
izapolsk authored and spusateri committed Jan 27, 2020
1 parent 18a260f commit 0436ee6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions cfme/fixtures/parallelizer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ class SlaveDetail(object):

appliance = attr.ib()
worker_config = attr.ib()
id = attr.ib(default=attr.Factory(lambda: next(SlaveDetail.slaveid_generator)))
id = attr.ib(default=attr.Factory(lambda: next(SlaveDetail.slaveid_generator)),
repr=lambda value: value.decode('utf-8'))
forbid_restart = attr.ib(default=False, init=False)
tests = attr.ib(default=attr.Factory(set), repr=False)
process = attr.ib(default=None, repr=False)
Expand Down Expand Up @@ -290,6 +291,7 @@ def monitor_shutdown(self, slave):

def _monitor_shutdown_t(self, slaveid, process):
# a KeyError here means self.slaves got mangled, indicating a problem elsewhere
slaveid = slaveid.decode('utf-8') if isinstance(slaveid, bytes) else slaveid
if process is None:
self.log.warning('Slave was missing when trying to monitor shutdown')

Expand Down Expand Up @@ -360,7 +362,7 @@ def send_tests(self, slave):
test_perc = self.sent_tests * 100 / collect_len
self.print_message(
f'sent {tests_len} tests '
f'to {slave.id} \n'
f'to {slave.id.decode("utf-8") if isinstance(slave.id, bytes) else slave.id} \n'
f'Total sent: {self.sent_tests} of {collect_len}, ({test_perc:.1f}%)'
)
return tests
Expand Down
2 changes: 1 addition & 1 deletion requirements/frozen.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ appdirs==1.4.3
asn1crypto==0.24.0
aspy.yaml==1.3.0
atomicwrites==1.3.0
attrs==19.1.0
attrs==19.3.0
azure==4.0.0
azure-applicationinsights==0.1.0
azure-batch==4.1.3
Expand Down
2 changes: 1 addition & 1 deletion requirements/frozen_docs.py3.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ anytree==2.6.0
appdirs==1.4.3
asn1crypto==0.24.0
atomicwrites==1.3.0
attrs==19.1.0
attrs==19.3.0
azure==4.0.0
azure-applicationinsights==0.1.0
azure-batch==4.1.3
Expand Down

0 comments on commit 0436ee6

Please sign in to comment.