X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=src%2Fbindings%2Fpython%2Fbt2%2Fbt2%2Fquery_executor.py;h=e9d3d761b16fba6f0a251598412737193c303cea;hp=6e2bbc8108731090924d04dba4ff6b9049fe414a;hb=9b4f9b425f2efce9a6ccc25f7ae062ebc1116a7d;hpb=1e92035335352f8a67cbc3de28a0ad44b7ee02a1 diff --git a/src/bindings/python/bt2/bt2/query_executor.py b/src/bindings/python/bt2/bt2/query_executor.py index 6e2bbc81..e9d3d761 100644 --- a/src/bindings/python/bt2/bt2/query_executor.py +++ b/src/bindings/python/bt2/bt2/query_executor.py @@ -21,6 +21,7 @@ # THE SOFTWARE. from bt2 import native_bt, object, utils +import bt2.interrupter import bt2.component import bt2.logging import bt2 @@ -38,15 +39,17 @@ class QueryExecutor(object._SharedObject): super().__init__(ptr) - def cancel(self): - status = native_bt.query_executor_cancel(self._ptr) - utils._handle_func_status(status, 'cannot cancel query executor object') + def add_interrupter(self, interrupter): + utils._check_type(interrupter, bt2.interrupter.Interrupter) + native_bt.query_executor_add_interrupter(self._ptr, interrupter._ptr) + + def interrupt(self): + native_bt.query_executor_interrupt(self._ptr) @property - def is_canceled(self): - is_canceled = native_bt.query_executor_is_canceled(self._ptr) - assert is_canceled >= 0 - return is_canceled > 0 + def is_interrupted(self): + is_interrupted = native_bt.query_executor_is_interrupted(self._ptr) + return bool(is_interrupted) def query( self, @@ -55,9 +58,6 @@ class QueryExecutor(object._SharedObject): params=None, logging_level=bt2.logging.LoggingLevel.NONE, ): - if self.is_canceled: - raise bt2.Canceled - if not isinstance(component_class, bt2.component._GenericComponentClass): err = False