Skip to content

Commit

Permalink
Merge pull request #3 from huseyinyilmaz/master
Browse files Browse the repository at this point in the history
pep8 issues, README. etc.
  • Loading branch information
kadirpekel committed Feb 21, 2013
2 parents 49879fc + dfd80dd commit f249dae
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 21 deletions.
22 changes: 22 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,28 @@ Octavious
Octavious is a very lightweight mutli processing framework helps you parallelize
your tasks within a plugin pipeline system.

Run the example app:
--------------------

::

$ python -m unittest -v octavious.tests
test_pipeline (octavious.tests.TestPipeline) ... ok
test_call_symbol (octavious.tests.TestUtils) ... ok
test_load_symbol (octavious.tests.TestUtils) ... ok

----------------------------------------------------------------------
Ran 3 tests in 0.001s

OK
$ python -m examples.simple
* Chuck Norris uses ribbed condoms inside out, so he gets the pleasure.

* Chuck Norris doesn't read books. He stares them down until he gets the information he wants.

* MacGyver can build an airplane out of gum and paper clips. Chuck Norris can kill him and take it.


Currently in very early stages, please stay tuned...

License
Expand Down
23 changes: 12 additions & 11 deletions examples/simple/__main__.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
from octavious.pipeline import Pipeline
from octavious.utils import pipeline, processor, plugin, parallelizer
from octavious.processor import ManyToOneProcessor, PipelineProcessor


cnj_processor = processor('examples.simple.processes.chucknjoke')
if __name__ == '__main__':

cnj_pipeline = pipeline(
plugin('examples.simple.plugins.echo'),
plugin('examples.simple.plugins.dictdigger', 'value.joke'),
plugin('examples.simple.plugins.jsondeserializer'),
)
cnj_processor = processor('examples.simple.processes.chucknjoke')

cnj_parallelizer = parallelizer('octavious.parallelizer.mp')
cnj_pipeline = pipeline(
plugin('examples.simple.plugins.echo'),
plugin('examples.simple.plugins.dictdigger', 'value.joke'),
plugin('examples.simple.plugins.jsondeserializer'))

onetomany = ManyToOneProcessor(PipelineProcessor(cnj_processor, cnj_pipeline),
cnj_parallelizer)
cnj_parallelizer = parallelizer('octavious.parallelizer.mp')

onetomany(range(1, 4))
onetomany = ManyToOneProcessor(PipelineProcessor(cnj_processor,
cnj_pipeline),
cnj_parallelizer)

onetomany(range(1, 4))
2 changes: 0 additions & 2 deletions examples/simple/plugins/dictdigger.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import json

from octavious.pipeline import Plugin


Expand Down
2 changes: 1 addition & 1 deletion octavious/parallelizer/mp.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def aux(result):
callback(result, cumulative=results)
pool = Pool(processes=self.worker_count)
for processor in processors:
async_result = pool.apply_async(
pool.apply_async(
processor, (input,), callback=aux)
pool.close()
pool.join()
Expand Down
3 changes: 2 additions & 1 deletion octavious/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ def __init__(self, plugins, propagates_exceptions=False):
def __eq__(self, other):
if isinstance(other, type(self)):
result = (self.plugins == other.plugins and
self.propagates_exceptions == other.propagates_exceptions)
self.propagates_exceptions ==
other.propagates_exceptions)
else:
result = NotImplemented
return result
Expand Down
3 changes: 0 additions & 3 deletions octavious/processor.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
from octavious.pipeline import Pipeline


class Processor(object):
"""Base class for all processors those define a custom processing unit"""

Expand Down
5 changes: 2 additions & 3 deletions octavious/utils.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from octavious.pipeline import Plugin, Pipeline
from functools import partial
from octavious.pipeline import Pipeline


def load_module(module_path, symbols=[]):
def load_module(module_path, symbols=()):
"""Loads a module by given module path
:param module_path: module path
Expand Down

0 comments on commit f249dae

Please sign in to comment.