Difficulty accessing command line function return value (Hadoop FSshell)

Discussion in 'Ruby' started by S D, Feb 16, 2009.

  1. S D

    S D Guest

    [Note: parts of this message were removed to make it a legal post.]

    I'm attempting to use Hadoop FS shell (
    http://hadoop.apache.org/core/docs/current/hdfs_shell.html) within a ruby
    script. My challenge is that I'm unable to get the function return value of
    the commands I'm invoking. As an example Hadoop FS shell command, I try to
    run get (http://hadoop.apache.org/core/docs/current/hdfs_shell.html#get) as
    follows

    hadoop fs -get /user/hadoop/testFile.txt .

    This should copy the file testFile.txt to my local directory. From the
    command line this generally works but I need to be able to verify that it is
    working in my ruby script. The command should return 0 on success and -1 on
    error. Based on

    http://pasadenarb.com/2007/03/ruby-shell-commands.html

    I have assumed that I should use backticks to make the hadoop call and get
    the return value. Here is a dialogue within irb in which the command was not
    successful:

    irb(main):001:0> `hadoop dfs -get testFile.txt .`
    get: null
    => ""

    and a dialogue within irb in which the command was successful

    irb(main):010:0> `hadoop dfs -get testFile.txt .`
    => ""

    In both cases, neither a 0 nor a 1 appeared as a return value; indeed
    nothing was returned. I'm considering posting this as a bug on the Hadoop
    site but I want to make sure that I'm not doing something wrong from a Ruby
    point of view.

    Your help is appreciated.

    Thanks,
    John
     
    S D, Feb 16, 2009
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. San Diego Guy
    Replies:
    0
    Views:
    756
    San Diego Guy
    Aug 7, 2003
  2. Seong-Kook Shin
    Replies:
    1
    Views:
    690
    Richard Bos
    Jun 18, 2004
  3. Steven D'Aprano
    Replies:
    4
    Views:
    515
    Paul Rubin
    Sep 25, 2006
  4. Greenhorn
    Replies:
    15
    Views:
    1,152
    Keith Thompson
    Mar 6, 2005
  5. CSINVA
    Replies:
    6
    Views:
    648
    Paul Delcogliano
    Nov 7, 2007
  6. Replies:
    4
    Views:
    767
    James Kanze
    Jul 22, 2008
  7. Bryan Duxbury

    Ruby Hadoop DFS Client?

    Bryan Duxbury, Oct 19, 2007, in forum: Ruby
    Replies:
    1
    Views:
    222
    Philip (flip) Kromer
    Aug 8, 2008
  8. AlexHWGUY
    Replies:
    5
    Views:
    308
    John W. Krahn
    Oct 24, 2006
Loading...