Yaniv Bronhaim has posted comments on this change. Change subject: Introducing context manager to terminate async processes on internal fail ......................................................................
Patch Set 5: (2 comments) https://gerrit.ovirt.org/#/c/51407/5/lib/vdsm/commands.py File lib/vdsm/commands.py: Line 47: def terminating(proc): Line 48: try: Line 49: yield proc Line 50: finally: Line 51: if proc.returncode is None: > We must use proc.poll() - returncode is updated only when you call communic there is no proc.poll, and I don't want to access private parts. returncode calls to poll Line 52: try: Line 53: proc.kill() Line 54: except Exception: Line 55: logging.exception("Cannot kill process %n" % proc.pid) Line 48: try: Line 49: yield proc Line 50: finally: Line 51: if proc.returncode is None: Line 52: try: > Lets put everything in the finally block in the try except, so we raise the poll is sync and can't raise. what's the different? Line 53: proc.kill() Line 54: except Exception: Line 55: logging.exception("Cannot kill process %n" % proc.pid) Line 56: if proc.returncode is None: -- To view, visit https://gerrit.ovirt.org/51407 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I003cce39d62dba5644937fafaf2c6e24c526c075 Gerrit-PatchSet: 5 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Yaniv Bronhaim <[email protected]> Gerrit-Reviewer: Dan Kenigsberg <[email protected]> Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer <[email protected]> Gerrit-Reviewer: Yaniv Bronhaim <[email protected]> Gerrit-Reviewer: gerrit-hooks <[email protected]> Gerrit-HasComments: Yes _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
