예제 #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)
예제 #2
0
파일: models.py 프로젝트: JensRantil/disco
    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)
예제 #3
0
 def stream(self):
     from disco.func import default_stream
     return [reify(stream) for stream in self.options.get('streams', ())
             ] or default_stream
예제 #4
0
 def __getcallable__(self, module, name):
     if hasattr(module, name):
         return getattr(module, name)
     return reify(name)
예제 #5
0
파일: objects.py 프로젝트: christofd/disco
 def __getcallable__(self, module, name):
     if hasattr(module, name):
         return getattr(module, name)
     return reify(name)
예제 #6
0
파일: objects.py 프로젝트: JensRantil/disco
 def stream(self):
     from disco.func import default_stream
     return [reify(stream) for stream in self.options.get('streams', ())] or default_stream