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@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to