map reduce time outs

Adam Lindsay a.lindsay at gmail.com
Sat Oct 13 09:08:16 EDT 2012


Hi David,

This one is actually documented:
 http://basho.github.com/riak-python-client/mapreduce.html#riak.mapreduce.RiakMapReduce.run

results = query.run(timeout=300000) #milliseconds = 5 minutes

adam
(mobile)

On 13 Oct 2012, at 08:40, David Montgomery <davidmontgomery at gmail.com> wrote:

> Hi,
> 
> I am trying to run this map reduce job.  I get a time out.  Logic
> would dictate that I add a time out to the RiakClient but that flag is
> not there.  How do I deal with timeouts with the python api?  I have
> data...I just cant get it out.
> 
> ile "/usr/local/lib/python2.7/dist-packages/riak-1.5.0-py2.7.egg/riak/transports/http.py",
> line 321, in mapred
>    (repr(response[0]), repr(response[1])))
> Exception: Error running MapReduce operation. Headers: {'date': 'Sat,
> 13 Oct 2012 07:26:31 GMT', 'content-length': '19', 'content-type':
> 'application/json', 'http_code': 500, 'server': 'MochiWeb/1.1
> WebMachine/1.9.0 (someone had painted it blue)'} Body:
> '{"error":"timeout"}'
> 
> client  = riak.RiakClient(host='111.111.111.111',port=8087,
> transport_class=riak.RiakPbcTransport)
>    query = client.add('impressions')
>    query.map('''
>    function(value, keyData, arg) {
>        var data = Riak.mapValuesJson(value)[0];
> 
>        if(data['adx']=='gdn'){
>            var alt_key = data['hw'] + '_' + data['adx'];
>            var obj = {};
>            obj[alt_key] = 1;
>            return [ obj ];
>        }else{
>           return [];
>        }
> 
> 
>    }''')
> 
>    query.reduce('''
>    function(values, arg){
>        return [ values.reduce( function(acc, item) {
>            for (var state in item) {
>                if (acc[state])
>                    acc[state] += item[state];
>                else
>                    acc[state] = item[state];
>            }
>            return acc;
>        })];
>    }
>    ''')
> 
>    for result in query.run():
>        print result
> 
> _______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20121013/e492ea5f/attachment.html>


More information about the riak-users mailing list