Files changed (23)
pyf.componentized permits to build data networks described in xml files, embeding python code or references to plugins.
This is the core package for flow-based programming, it contains the building blocks for pyf.manager, pyf.componentized and pyf.services.
This is a low-level utility library used to split input flows and store them in buckets on the filesystem.
+This tutorial assumes you've already `installed <http://pyfproject.org/en/getting-started>`_ and `setup <http://pyfproject.org/en/getting-started/configuring>`_ pyf.services.
+If you haven't, please follow the steps on the `getting started <http://pyfproject.org/en/getting-started>`_ pages of the website.
+This tutorial will show how to design a simple tube directly with your web browser on your PyF.Services instance.
+The tube that we will create is similar to the ones we created in the other tutorials (one producer, two filters, two adapters and one csv writer, similar to a process managing user accounts for security).
+ To get more information about nodes from code (code items), see :class:`pyf.componentized.components.CodeComponent`
+3. Now, let's separate the flow in two branches, one with the "high" level and another branch with the "low" and "medium" items.
+ a. For our first branch, we will use a plugin, named :class:`SimpleFilter <pyf.components.adapters.standardtools.SimpleFilter>` that will only let the items validating the expression "item.level == 'high'" pass through it.
+ A very important thing when you make adapters, is to remember the way PyF works : it uses generators.
+ So, to let the other branches keep executing you have to yield items. For that matter, we use a special Python objects : Ellipsis.
+ Those objects will be ignored by the rest of the components but let you say "I've received an item, but I don't want to send anything in the flow" (it is very useful for filters or aggregators that will take a lot of items and yield Totals at the end for example).
+ a. For our first branch, we will use the plugin way, with a plugin named :class:`ComputeAttributes<pyf.components.adapters.standardtools.ComputeAttributes>` that is specialised in adaptation of input objects by defining attribute getters on them, without modifying the input object (the objects that are outputed by this plugin are proxy objects, :class:`DynamicObjectAdapter <pyf.components.adapters.standardtools.DynamicObjectAdapter>` with attribute getters).
+ Each of the attribute getters can access item (the adapted item, with access to other attributes getter defined, and base_item, the item not adapted (useful to redefine attributes)).
+ Please not that this example isn't the best one as we modify the entering object (so you shouldn't make it pass in another branch at the same time), using Packets removes this problem as packets ca be modified and won't be the same on all branches (another solution is to use DynamicObjectAdapter).
+5. Last step is to add a CSVWriter. This is self explanatory, really. Just one thing, if you don't specify the attribute, the column title will be used.
+1. To launch your tube, either click the launch button from the design view or visit the tube page (the green arrow on the actions for the tubes in the tube list) and click Launch.
In the tutorials series we will cover the 4 main levels at which you can use PyF. Depending on which kind of way you want to use pyf you should read the corresponding tutorial.
- - The low-level tutorial is written for people who want to understand the internals of pyf, but keep in mind that pyf's interest lies in its network and components architecture. Each tutorial will build upon the previous one and thus will continue the source code and exemples of the previous tuturial assuming that you know it already.
+ - The :ref:`low-level tutorial <lowleveltutorial>` is written for people who want to understand the internals of pyf, but keep in mind that pyf's interest lies in its network and components architecture. Each tutorial will build upon the previous one and thus will continue the source code and exemples of the previous tuturial assuming that you know it already.
- - The network tutorial shows how to wire components together using a network manager instead of building all the wires between components by yourself.
+ - The :ref:`network tutorial <networktutorial>` shows how to wire components together using a network manager instead of building all the wires between components by yourself.
- - The componentized (plugin-based) layer tutorial shows how to wire components without using code.
+ - The componentized (plugin-based) layer tutorial shows how to wire components without using code.
- - Finally, the design tool of pyf.services (the web service) shows how to use the componentized layer without writing xml code, focusing on what you want to achieve.
+ - Finally, the :ref:`design tool <designtutorial>` of pyf.services (the web service) shows how to use the componentized layer without writing xml code, focusing on what you want to achieve.
-If you want to go straight to the fun part, I recommend reading directly the design tutorial, and then, to understand how it works at lower levels reading the others tutorial if needed.
+If you want to go straight to the fun part, I recommend reading directly the :ref:`design tutorial <designtutorial>`, and then, to understand how it works at lower levels reading the others tutorial if needed.
In the tutorials we consider that you have successfully installed the necessary pyf layers. If you haven't, please go to the corresponding section on the website.
PyF is architectured with different layers, each level is based on the level directly under it. :ref:`Read more ... <architecture>`