def read(self, request, *args, **kwargs): from discodex.mapreduce.func import reify method = str(kwargs.pop('method', None) or '') arg = str(kwargs.pop('arg', None) or '') streams = [reify(s) for s in kwargs.pop('streams').split('|') if s] reduce = reify((kwargs.pop('reduce') or 'None').strip('}')) try: job = DiscoDBIterator(disco_master, disco_prefix, self.index, method, arg, streams, reduce, **dict(request.GET.items())).run() except DiscoError, e: return HttpResponseServerError("Failed to run DiscoDB job: %s" % e)
def stream(self): from disco.func import default_stream return [reify(stream) for stream in self.options.get('streams', ()) ] or default_stream
def __getcallable__(self, module, name): if hasattr(module, name): return getattr(module, name) return reify(name)
def stream(self): from disco.func import default_stream return [reify(stream) for stream in self.options.get('streams', ())] or default_stream