Example #1
0
    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)
Example #2
0
    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)
Example #3
0
 def stream(self):
     from disco.func import default_stream
     return [reify(stream) for stream in self.options.get('streams', ())
             ] or default_stream
Example #4
0
 def __getcallable__(self, module, name):
     if hasattr(module, name):
         return getattr(module, name)
     return reify(name)
Example #5
0
 def __getcallable__(self, module, name):
     if hasattr(module, name):
         return getattr(module, name)
     return reify(name)
Example #6
0
 def stream(self):
     from disco.func import default_stream
     return [reify(stream) for stream in self.options.get('streams', ())] or default_stream