Nir Soffer has posted comments on this change. Change subject: executor: introduce the executor library ......................................................................
Patch Set 11: I checked integrating this in the sampling patch (http://gerrit.ovirt.org/29980), and it seems that passing the responsibility for discarding tasks on the caller is not the right solution. The caller of this executor should not care about maintaining available workers in the executor. This should be handled by the executor. Otherwise we will have to duplicate this code in all the clients. To keep this simple, we can add an optional timeout argument to dispatch: def dispatch(self, task, timeout=None): ... The timeout can mean, this task is expected to finish in timeout seconds, and if not, you can consider this task as stuck, and do what you need to do about that. So the caller has full control, but does not have to care about how timed out task are handled. To handle the timeout, we can schedule the BackgroundThread.discard() call using a scheduler. If the timeout expired while the call is running, the worker thread will be discarded. When the call finish. This is an example how we can implement this: http://pastebin.com/iMTN8wkA Since the caller does not care any more about discarding, we can simplify the interface and return nothing from dispatch(). -- To view, visit http://gerrit.ovirt.org/29191 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic06da1ba57868dc2c7db67a1868ad10087a1cff2 Gerrit-PatchSet: 11 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Francesco Romani <[email protected]> Gerrit-Reviewer: Antoni Segura Puimedon <[email protected]> Gerrit-Reviewer: Dan Kenigsberg <[email protected]> Gerrit-Reviewer: Dima Kuznetsov <[email protected]> Gerrit-Reviewer: Federico Simoncelli <[email protected]> Gerrit-Reviewer: Francesco Romani <[email protected]> Gerrit-Reviewer: Michal Skrivanek <[email protected]> Gerrit-Reviewer: Nir Soffer <[email protected]> Gerrit-Reviewer: Saggi Mizrahi <[email protected]> Gerrit-Reviewer: Vinzenz Feenstra <[email protected]> Gerrit-Reviewer: Yaniv Bronhaim <[email protected]> Gerrit-Reviewer: [email protected] Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: No _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
