Skip to content

Commit

Permalink
docs work for 0.1.9
Browse files Browse the repository at this point in the history
  • Loading branch information
gj authored and gj committed Sep 8, 2018
1 parent 0033621 commit 62a3c48
Show file tree
Hide file tree
Showing 17 changed files with 207 additions and 138 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ below is the flow graph generated by Botflow.Aggreate 6 exchanges bitcoin price

- **Fast**
Nodes will be run in parallel, and they will perform well when processing stream data.
:Web Crawle: Botflow is 5x fatter than Scrapy
:Web Crawle: Botflow is 10x fatter than Scrapy



Expand Down
12 changes: 0 additions & 12 deletions docs/bot/exception.rst

This file was deleted.

22 changes: 18 additions & 4 deletions docs/bot/index.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Bot BotFrame
Bot
============


Expand All @@ -7,13 +7,27 @@ Bot BotFrame
.. toctree::
:maxdepth: 1

run
replay

.. contents::
:local:


Exception policy
----------------
Run
---

Exception
---------


Exception behavior will act according to ```config.Exception_policy = config.Exception_raise ``` setting.

:Exception_default: default exception policy is raise
:Exception_raise: raise exception
:Exception_ignore: ignore exception. exception raised from node will be suppressed.
:Exception_retry: the value will put in input-queue after some delay.
:Exception_pipein: the exception tread as returen value ,put in output queue. it will be usefull
in blockedjoin route scenarios.


How to debug
Expand Down
69 changes: 69 additions & 0 deletions docs/change/0.1.9.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
Version 0.1.9
=============


#. Officially rename project to Botflow.

#. Enable Http Server support.Pipe can be work as Coroutine for intergate other asyncio framework.

.. code-block:: python
from botflow import *
from aiohttp import web
p = Pipe(
{"msg":"hello world!"}
)
app = web.Application()
app.add_routes([
web.get('/', p.aiohttp_json_handle)
])
Bot.run_app(app)
#. Add new Route "SendTo". It can be used for redirect to data flow to the Node.

.. code-block:: python
def filter(url):
global count
if 'http' not in url:
url = "http://127.0.0.1:8080{}".format(url)

if url in seen : #filter out processed links
return None
seen.add(url)
return url


def find_all_links(r):
for a in r.soup.find_all('a', href=True):
yield a.get('href')




b = Return(

filter,
HttpLoader(),
find_all_links,
)

Pipe(
"http://127.0.0.1:8080/",
b,
SendTo(b),

)

#. Add new Node type "SpeedLimit" "Delay" .For speed control

#. Add new Node type "Zip". For zip multi flow item to list.

#. Rewrite whole project for code more readable.

#. import flow graph performance by reduce the node .
1 change: 1 addition & 0 deletions docs/change/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ Change
.. toctree::
:maxdepth: 1

0.1.9
0.1.8
15 changes: 8 additions & 7 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@ Welcome to Botflow's world!



The Botflow applicaton is made with one or many pipes and run by ```BotFrame.run()```.
The Botflow applicaton is made with one or many pipes and run by ```Bot.run()```.
The simplest applicaton looks like:

.. code-block:: python
from botflow import *
Pipe(print)
BotFrame.run()
Bot.run()
Concept of the Botflow is very simple. ```I doubt if it is good to write a guide :-)```
Concept of the Botflow is very simple.


**Pipe** works at the Top level. It combines the Node and Route together.
Expand Down Expand Up @@ -75,10 +76,10 @@ The above two code blocks look like pseudo code, but they are workable samples.
:caption: Contents:
bot/index
pipe/index
node/index
route/index
change/0.1.8
pipe
node
route
change/index
.. toctree::
:maxdepth: 1
Expand Down
79 changes: 73 additions & 6 deletions docs/node/index.rst → docs/node.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Node
====

.. contents::
:local:

Node is callable thing .In python world ,we have three callable things ,

- function
Expand Down Expand Up @@ -46,12 +49,76 @@ Exception behavior will act according to ```config.Exception_policy = config.Exc
:local:


.. toctree::
:maxdepth: 1
Timer
------

It will send a message in the pipe by timer param. delay, max_time until some finished

```Timer(self, delay=1, max_time=None, until=None)```


:dealy: the delay between every count
:max_time: will stop when reach the max count time.
:until: the function ref. Timer will count until function return True.


HttpLoader
-----------

Get a url and return the HTTP response

Init parameter
--------------

:timeout:
default timeout=20 .

Callable parameter:
------------------

can be call by string (url), and Httprequest.

HttpResponse
------------
HttpResponse


:json: return a json object
:text: get text body of the httpresponse
:xml: get lxml object
:css: get css object


HttpRequest
------------

:head:
:body:
:url:
:proxy:



AioFile
----------------
for file I/O.

SpeedLimit
----------

limit the stream speed limit

Delay
------

delay in special second.
Zip
-----
Wait for all branched to finish and merged the result into a tuple.

Filter
-----

http
db
file
util
Drop data from pipe if it does not match some condition


2 changes: 0 additions & 2 deletions docs/node/db.rst

This file was deleted.

2 changes: 0 additions & 2 deletions docs/node/file.rst

This file was deleted.

36 changes: 0 additions & 36 deletions docs/node/http.rst

This file was deleted.

17 changes: 0 additions & 17 deletions docs/node/util.rst

This file was deleted.

File renamed without changes.
2 changes: 0 additions & 2 deletions docs/pipe/application.rst

This file was deleted.

27 changes: 21 additions & 6 deletions docs/route/index.rst → docs/route.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,34 @@ Return
------
Route Return is derived from Branch with parameter (share=False,join=True)

Branch,Return,Filter
====================


.. image:: Botflow_branch.jpg
:width: 300



:share: True|False. if keep the orignal data for parent pipe

:route_type: list of Type for route upflow message to Branch

:join: True|False ,if Return the final message to parent Pipe.



Filter
------
Route Filter is derived from Branch .it will drop out message ,if not match (route_type,route_func)
sametime.


Fork
Join
----
Basic route of Botflow. it create branch for every pass in (node or route).

Join is derived from Fork with parameter(share=False,join=True) .


Join
----
Join is derived from Fork with parameter(share=False,join=True) .
SendTo
------
Send the stream to speicaled Node.
15 changes: 0 additions & 15 deletions docs/route/Branch.rst

This file was deleted.

2 changes: 0 additions & 2 deletions docs/route/Fork.rst

This file was deleted.

Loading

0 comments on commit 62a3c48

Please sign in to comment.