ORBIT-USER: Ruby modules
Max Ott
max at winlab.rutgers.edu
Wed Aug 2 19:11:08 EDT 2006
Daryl,
The nodehandler runs in a sandbox only containing the parts it needs.
If you want to use a library which is installed on the machine (and
I'm pretty sure mysql is as it is part of the 1.8 distribution) you
need to extend ruby's load path. You can do that by appropriately
setting the '$:' variable at the beginning of the script (and before
the 'require'). The global variable $: is an array of places to search
for loaded files. A starting point is to add a
debug("Load path: ", $:.join(':'))
to the beginning of the script and see where it looks.
$: << "directory where mysql sits"
Should get you on your way.
I would appreciate if you would keep me updated on what you want to do
with this and how its working out. We are experimenting with a more
conveninet interface to the database but I'm not sure when we release
it. Any real use cases would help us tremendously.
-max
p.s. Try to use the C-based mysql adaptor. The native ruby adaptor
only works with V4 of the mysql server. Right now, tat's what we are
using, but we may upgrade in the future which would break your world.
On 8/3/06, Daryl Siu <dsbruin at gmail.com> wrote:
> Ok I tried using both "require 'mysql'" and "require 'dbi'" but neither
> compiled on nodehandler. I found both of those modules via
> http://www.kitebird.com/articles/ruby-mysql.html
> http://www.kitebird.com/articles/ruby-dbi.html
>
> Thanks!
>
> Daryl
>
>
> On 8/1/06, Daryl Siu <dsbruin at gmail.com> wrote:
> >
> > Ok thanks! I'll check and see if my calls work.
> >
> > Daryl
> >
> >
> >
> > On 8/1/06, Sachin Ganu < sachinganu at gmail.com> wrote:
> > > Hi Daryl,
> > >
> > > Were you thinking of using mysql calls from inside the script so as to
> > > get some measurements into your feedback loop, during experiment run
> > > time? Console should already have packages installed for these calls ,
> > > but can you let us know if there is any particular debian package that
> > > has this. If it does not exist on the console, we can look into
> > > installing it.
> > >
> > > Thanks for the note
> > >
> > > -Sachin
> > >
> > > On 8/1/06, Daryl Siu < dsbruin at gmail.com> wrote:
> > > > Hi everybody, I have been doing some searching on the net and found a
> couple
> > > > of Ruby modules that look to be really nice for writing scripts. I
> was
> > > > wondering if such items as the mysql module and the dbi module have
> been
> > > > installed for nodehandler. These allow for running queries to the
> database
> > > > in run time in Ruby and wanted to check if I would need to install any
> of
> > > > these when I run my script. Thanks!
> > > >
> > > > --
> > > > Daryl Siu
> > >
> >
> >
> >
> >
> > --
> >
> > Daryl Siu
>
>
>
> --
> Daryl Siu
--
Dr. Max Ott
Research Program Leader - Network and Pervasive Computing, NICTA Australia
Founder & CTO, Semandex Networks
Research Professor, WINLAB, Rutgers University
More information about the orbit-user
mailing list