Skip to content

Commit

Permalink
Update README: describes main features and quickstart
Browse files Browse the repository at this point in the history
  • Loading branch information
Greg Leclercq committed Jul 16, 2014
1 parent 1c953e0 commit f9454d1
Showing 1 changed file with 60 additions and 1 deletion.
61 changes: 60 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,66 @@ It tries to mimics the interface of the Python `concurrent.futures
Features
--------

* TODO
- Provides a ``Future`` abstraction to define dependencies between tasks.
- Define asynchronous tasks from callables.
- Handle workflows with Amazon SWF.
- Implement replay behavior like the Amazon Flow framework.
- Handle retry of tasks that failed.
- Automatically register decorated tasks.
- Handle the completion of a decision with more than 100 tasks.
- Provides a local executor to check a workflow without Amazon SWF (see
``simpleflow --local`` command).

Quickstart
----------

Let's take a simple example that computes the result of ``(x + 1) * 2``.

We need to declare the functions as activities to make them available:

.. code::
from simpleflow import activity
@activity.with_attributes(task_list='quickstart')
def increment(x):
return x + 1
@activity.with_attributes(task_list='quickstart')
def double(x):
return x * 2
And then define the workflow itself in a ``example.py`` file:

.. code::
from simpleflow import Workflow
class SimpleComputation(Workflow):
def __call__(self, x):
y = self.submit(increment, x)
z = self.submit(double, y)
return z.result
Now check that the workflow works locally: ::

$ simpleflow --local -w example.SimpleComputation -i example/input.json

The file ``example/input.json`` contains the input passed to the workflow. It
should have the format:

.. code::
{"args": [1],
"kwargs": {}
}
which is equivalent to:

.. code::
{"kwargs": {"x": 1}}
Documentation
-------------
Expand Down

0 comments on commit f9454d1

Please sign in to comment.