bt2: do not require sink component's _graph_is_configured() method
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Mon, 22 Jul 2019 17:45:22 +0000 (13:45 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Tue, 23 Jul 2019 13:07:19 +0000 (09:07 -0400)
The "graph is configured" method is not required when you implement a
component class in C, as it's not strictly needed to make the graph
runnable, so it should not be required in Python either.

A default _UserSinkComponent._graph_is_configured() method is added to
make it optional.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I3ef4e3d159af61e2d06a0a47dddc1234aed93ae1
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1740
Tested-by: jenkins <jenkins@lttng.org>
src/bindings/python/bt2/bt2/component.py

index d7d42a71bf1447e1b2a46e07022d22268c8feebd..f31842181aa196dc81e681130ab8a796f7a5e7d5 100644 (file)
@@ -481,13 +481,6 @@ class _UserComponentType(type):
                 cls, comp_cls_name, comp_cls_descr, comp_cls_help
             )
         elif _UserSinkComponent in bases:
-            if not hasattr(cls, '_graph_is_configured'):
-                raise bt2.IncompleteUserClass(
-                    "cannot create component class '{}': missing a _graph_is_configured() method".format(
-                        class_name
-                    )
-                )
-
             if not hasattr(cls, '_consume'):
                 raise bt2.IncompleteUserClass(
                     "cannot create component class '{}': missing a _consume() method".format(
@@ -833,6 +826,9 @@ class _UserSinkComponent(_UserComponent, _SinkComponent):
     def _bt_graph_is_configured_from_native(self):
         self._graph_is_configured()
 
+    def _graph_is_configured(self):
+        pass
+
     @property
     def _input_ports(self):
         def get_input_port_count(self_ptr):
This page took 0.026716 seconds and 4 git commands to generate.