calling erlang module, function from python-riak client in mapreduce

Gopi Krishna gopi at lintelindia.com
Mon May 26 09:37:49 EDT 2014


Hi erik,

yes i have exported the function,and also i have put the beam file under
the riaks path in side the app.config file as

riak_kv

{riak_kv, [
            %% beam files for mapreduce

{add_paths,["/home/intel/gopi/sam_programmes/erl/erlmap/beams"]},


In the beams file i have maps.beam file.



On Mon, May 26, 2014 at 6:52 PM, Erik Søe Sørensen <ess at trifork.com> wrote:

> Hello -
> Did you ensure that the function in question is exported from the module?
> (Also: that the beam file is placed in the Riak node's search path?)
>
>
>
> -------- Oprindelig meddelelse --------
> Fra: Gopi Krishna
> Dato:26/05/2014 14.18 (GMT+01:00)
> Til: riak-users at lists.basho.com
> Emne: calling erlang module,function from python-riak client in mapreduce
>
> Hi all,
>
> I've been doing the thing get the map phase work in query.map() in
> python-riak client.
>
> I have written a function in erlang.
>
> funs(Obj,_,_) -> [riak_object:get_value(Obj)].
>
> I have saved it in a file called maps.erl
>
> I have compiled the maps.erl to get the maps.beam file to give the path of
> the beam files under tha app.config.
>
>  I have given path like as metnioned in the riak documents.
>
> Now i want to get the values out from the map phase udner the python-riak
> client by sending erlang module and map function to the query.map() phase.I
> have given like :
>
> query.map(['maps','funs'])
> query.run() is giving me error like below, please tell me where i have
> done or what is the correct to way to implement it.
>
>
>
> Traceback (most recent call last):
>   File "<input>", line 1, in <module>
>   File
> "/usr/lib/python2.6/site-packages/riak-1.5.2-py2.6.egg/riak/mapreduce.py",
> line 234, in run
>     result = t.mapred(self._inputs, query, timeout)
>   File
> "/usr/lib/python2.6/site-packages/riak-1.5.2-py2.6.egg/riak/transports/http.py",
> line 322, in mapred
>     (repr(response[0]), repr(response[1])))
> Exception: Error running MapReduce operation. Headers: {'date': 'Mon, 26
> May 2014 11:24:04 GMT', 'content-length': '1121', 'content-type':
> 'application/json'
> , 'http_code': 500, 'server': 'MochiWeb/1.1 WebMachine/1.10.0 (never
> breaks eye contact)'} Body:
> '{"phase":0,"error":"undef","input":"{ok,{r_object,<<\\"tst\
>
> \">>,<<\\"test5\\">>,[{r_content,{dict,3,16,16,8,80,48,{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]},{{[],[],[],[],[],[],[],[],[],[],[[<<\\"X-Riak-VTag\\
>
> ">>,50,53,75,69,55,80,113,109,65,69,117,106,109,109,99,65,72,101,75,82,115,86]],[[<<\\"index\\">>]],[],[[<<\\"X-Riak-Last-Modified\\">>|{1400,340359,663135}]
>
> ],[],[]}}},<<\\"6\\">>}],[{<<197,82,177,11,83,115,139,10>>,{1,63567559559}}],{dict,1,16,16,8,80,48,{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]},{{[],[],
>
> [],[],[],[],[],[],[],[],[],...}}},...},...}","type":"error","stack":"[{maps,funs,[{r_object,<<\\"tst\\">>,<<\\"test5\\">>,[{r_content,{dict,3,16,16,8,80,48,{
>
> [],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]},{{[],[],[],[],[],[],[],[],[],[],[[<<\\"X-Riak-VTag\\">>,50,53,75,69,55,80,113,109,65,69,117,106,109,109,99,6
>
> 5,72,101,75,82,115,86]],[[<<\\"index\\">>]],[],[[<<\\"X-Riak-Last-Modified\\">>|{1400,340359,663135}]],[],[]}}},<<\\"6\\">>}],[{<<197,82,177,11,83,115,139,10
>
> >>,{1,63567559559}}],{dict,1,16,16,8,80,48,{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]},{{[],[],[],[],[],[],[],...}}},...},...],...},...]"}'
>
> --
>
> Thanks & Regards,
> J.Gopi Krishna
> +91-8341452934,
> www.lintelindia.com<http://www.lintelindia.com>
> Lintel Technologies Pvt. LTD,Hyderabad.
>
> This message contains confidential information and is intended for
> recipient. If you are not the intended recipient you are notified that
> disclosing, copying, distributing or taking any action in reliance on the
> contents of this information is strictly prohibited. E-mail transmission
> cannot be guaranteed to be secure or error-free as information could be
> intercepted, corrupted, lost, destroyed, arrive late or incomplete, or
> contain viruses. The sender therefore does not accept liability for any
> errors or omissions in the contents of this message, which arise as a
> result of e-mail transmission. If verification is required please request a
> hard-copy version.
> _______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>



-- 

Thanks & Regards,
J.Gopi Krishna
+91-8341452934,
www.lintelindia.com
Lintel Technologies Pvt. LTD,Hyderabad.

This message contains confidential information and is intended for
recipient. If you are not the intended recipient you are notified that
disclosing, copying, distributing or taking any action in reliance on the
contents of this information is strictly prohibited. E-mail transmission
cannot be guaranteed to be secure or error-free as information could be
intercepted, corrupted, lost, destroyed, arrive late or incomplete, or
contain viruses. The sender therefore does not accept liability for any
errors or omissions in the contents of this message, which arise as a
result of e-mail transmission. If verification is required please request a
hard-copy version.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20140526/194a8693/attachment.html>


More information about the riak-users mailing list