Przeglądaj źródła

More info on callback functions in process enactment

Yentl Van Tendeloo 8 lat temu
rodzic
commit
41b173bb36
1 zmienionych plików z 14 dodań i 1 usunięć
  1. 14 1
      doc/process_enactment.rst

+ 14 - 1
doc/process_enactment.rst

@@ -30,4 +30,17 @@ The third parameter is a dictionary of callbacks.
 For each activity, it is possible for users to define a callback function.
 This function will be invoked when the specific activity is executed.
 For example, a manual operation will require user input, for which this callback function can then serve.
-Further details are given later.
+In this case, lets assume that an activity in the process model, termed *refine_petrinet*, is a manual operation and requires user interaction.
+The call then becomes::
+
+    >>> def callback():
+    ...     # Any code required to create the Petrinet
+    ...     p = instantiate(None, "Place")
+    ...     t = instantiate(None, "Transition")
+    ...     instantiate(None, "P2T", (p, t))
+    ...     # Alternatively, we could have used raw_input() or so to prompt the user
+    ...
+    >>> process_execute("query_state_space", "my_", {"refine_petrinet": callback})
+
+When the process executes *refine_petrinet*, the callback function is executed, and the manual operation is terminated when the function terminates.
+Other types of operation, such as *model transformations* and *action language* can also have a callback function, but this is usually less important to end users and is therefore not elaborated on here.