You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>To create simple processor stage application first decide input and
64
64
output data format. In following examples we will work with data in JSON
65
65
format (for the full list of supported formats check
66
-
<spanclass="xref std std-ref">pyDKB.dataflow.messages</span> section of this documentation).</p>
66
+
<aclass="reference internal" href="pyDKB.dataflow.communication.messages.html#pydkb-dataflow-communication-messages"><spanclass="std std-ref">pyDKB.dataflow.communication.messages module</span></a> section of this documentation).</p>
67
67
<p>Now let`s start writing example processor <codeclass="docutils literal notranslate"><spanclass="pre">welcome.py</span></code> and implement
68
68
message handler – functional part of the stage (operations to be
<p>First we create stage object and indicate that input and output message
120
-
format is JSON: <codeclass="docutils literal notranslate"><spanclass="pre">stage</span><spanclass="pre">=</span><spanclass="pre">JSONProcessorStage()</span></code> (for full list of
121
-
processors check <aclass="reference internal" href="pyDKB.dataflow.stage.html#pydkb-dataflow-stage"><spanclass="std std-ref">pyDKB.dataflow.stage package</span></a> section of this documentation);
122
-
then set stage processing function to our function <codeclass="docutils literal notranslate"><spanclass="pre">my_process()</span></code>,
123
-
parse command line arguments (<codeclass="docutils literal notranslate"><spanclass="pre">stage.parse_args(sys.argv[1:])</span></code>) and
124
-
start the stage execution.</p>
122
+
<p>First we create stage object: <codeclass="docutils literal notranslate"><spanclass="pre">stage</span><spanclass="pre">=</span><spanclass="pre">JSONProcessorStage()</span></code>; then indicate
123
+
that input and output message format is JSON:
124
+
<codeclass="docutils literal notranslate"><spanclass="pre">stage.set_{input,output}_message_type(messageType.JSON)</span></code> (for full list of
125
+
message types check <aclass="reference internal" href="pyDKB.dataflow.communication.messages.html#pydkb-dataflow-communication-messages"><spanclass="std std-ref">pyDKB.dataflow.communication.messages module</span></a> section of this
126
+
documentation); then set stage processing function to our function
127
+
<codeclass="docutils literal notranslate"><spanclass="pre">my_process()</span></code>, parse command line arguments and configure stage instance
128
+
according to it (<codeclass="docutils literal notranslate"><spanclass="pre">stage.configure(sys.argv[1:])</span></code>). Now we ready to start the
129
+
stage execution.</p>
125
130
<p>Easy, right?</p>
126
131
<p>It`s time to run our application. Create input data sample
127
132
<codeclass="docutils literal notranslate"><spanclass="pre">input.ndjson</span></code> with following lines:</p>
0 commit comments