Skip to content

Instantly share code, notes, and snippets.

@cwvh
Created December 11, 2011 21:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cwvh/1462946 to your computer and use it in GitHub Desktop.
Save cwvh/1462946 to your computer and use it in GitHub Desktop.
from pipeline import pipeline
@pipeline()
def foo():
pass
@pipeline()
def baz():
pass
print "Okay, here we go!"
pipeline.run()
import zmq
__all__ = ['pipeline']
pipelines = {}
class pipeline(object):
def __init__(self, in_ports, out_port, ip='localhost'):
...
def __call__(self, fn):
if self.inputs:
def pipeline():
ready = dict(self.poller.poll())
for input in self.inputs:
if ready.get(input) == zmq.POLLIN:
if self.output:
self.output.send(fn(input.recv()))
else:
fn(input.recv())
elif self.output:
def pipeline():
self.output.send(fn())
else:
pipeline = fn
pipelines[fn.__name__] = pipeline
@staticmethod
def run():
for name, function in pipelines.iteritems():
print 'forking', name, 'and running!'
#forkexec function()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment