Return-Path: X-Original-To: apmail-storm-user-archive@minotaur.apache.org Delivered-To: apmail-storm-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8B43818F72 for ; Wed, 3 Feb 2016 11:35:07 +0000 (UTC) Received: (qmail 57826 invoked by uid 500); 3 Feb 2016 11:35:00 -0000 Delivered-To: apmail-storm-user-archive@storm.apache.org Received: (qmail 57783 invoked by uid 500); 3 Feb 2016 11:35:00 -0000 Mailing-List: contact user-help@storm.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@storm.apache.org Delivered-To: mailing list user@storm.apache.org Received: (qmail 57771 invoked by uid 99); 3 Feb 2016 11:35:00 -0000 Received: from Unknown (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Feb 2016 11:35:00 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 01FF1C1C58 for ; Wed, 3 Feb 2016 11:35:00 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.179 X-Spam-Level: * X-Spam-Status: No, score=1.179 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-us-east.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id Na1Z8dim5EAr for ; Wed, 3 Feb 2016 11:34:59 +0000 (UTC) Received: from mail-yk0-f180.google.com (mail-yk0-f180.google.com [209.85.160.180]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with ESMTPS id DAD6B42A41 for ; Wed, 3 Feb 2016 11:34:58 +0000 (UTC) Received: by mail-yk0-f180.google.com with SMTP id z7so15163304yka.3 for ; Wed, 03 Feb 2016 03:34:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=/32llpSEtAhRKiLnbY6Mh6F/PMN58fLQCzLPCcxvfeg=; b=0SPsTAYqWJzxEOsUMs0rVe8f8I3zkjvYFMwOKGGbNDdh6dgX75g4J++x/OapN2XoGw f2moJ7374as7G5rRC31c/gfti0d7BAH9ID4aga/Ookd1Q2DvJcNBCaHk36b9qECTm1a3 ydbEhYJ7d3KDeygxaf3CCinGzzpQ0gJ9N8pAkZUKiV4w4QcAoVLj7o+cWFjCzCrTUzDf 2HpFA+IuhKymhQjQY40Y81rXqXxm59iDXc8PqKiD6aB7RMXbEfpK7biF5ymAhiHzgU/o 6ygX2SZKWeQjr8mOdRITZpxAma4C1psgKRCXPv220waKEmA2egGXTwfIp0cOYGHAhzO7 r8zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=/32llpSEtAhRKiLnbY6Mh6F/PMN58fLQCzLPCcxvfeg=; b=FO96QkePN2rr1+84Wy/TfyXLbjWkTvObAsHDX45oTUBFO3IMM/krOWgF9PBLEVm8Og sPZYhNJJGAnQL+jfmI3lu7nZiDXpvj5o8eosLUhZ/zlkxCXwCR6VVL533gvhXA92ZasM K2PbXCpbeD7v62KMF4PnurPNoYpv+T/53WESKAAXAuY8AdcHKvTrCV5zDHix9EAZaIcL zbGQ5+G+gASCvC14AwYAY0U4U+0imFqzSRXtrAiv/siRF9CIXPHAuk7NC5WWCK8D/wB1 Kye40HCFZtUpI6Mid8aKyWgQLFay9ECvUKxC/ckh7llfmEnMoleQz4M+FF7bccMQa/H7 e77A== X-Gm-Message-State: AG10YOQQXNUWey/3Xf3tVtsN3Hg448R+p129FJGrkSP9FMYidRGnmZx5d30QWjGj23U4jn83uYL4jj5h0GpfKQ== MIME-Version: 1.0 X-Received: by 10.37.4.77 with SMTP id 74mr508034ybe.186.1454499298614; Wed, 03 Feb 2016 03:34:58 -0800 (PST) Received: by 10.37.10.5 with HTTP; Wed, 3 Feb 2016 03:34:58 -0800 (PST) In-Reply-To: References: Date: Wed, 3 Feb 2016 19:34:58 +0800 Message-ID: Subject: Re: Storm + HDFS From: K Zharas To: user@storm.apache.org Content-Type: multipart/alternative; boundary=001a11c00ce40526dd052adc0253 --001a11c00ce40526dd052adc0253 Content-Type: text/plain; charset=UTF-8 Can anyone help to create a Spout which reads a file from HDFS? I have tried with the code below, but it is not working. public void nextTuple() { Path pt=new Path("hdfs://localhost:50070/user/BCpredict.txt"); FileSystem fs = FileSystem.get(new Configuration()); BufferedReader br = new BufferedReader(new InputStreamReader(fs.open(pt))); String line = br.readLine(); while (line != null){ System.out.println(line); line=br.readLine(); _collector.emit(new Values(line)); } } On Tue, Feb 2, 2016 at 1:19 PM, K Zharas wrote: > Hi. > > I have a project I'm currently working on. The idea is to implement > "scikit-learn" into Storm and integrate it with HDFS. > > I've already implemented "scikit-learn". But, currently I'm using a text > file to read and write. However, I need to use HDFS, but finding it hard to > integrate with HDFS. > > Here is the link to github . > (I only included files that I used, not whole project) > > Basically, I have a few questions if you don't mint to answer them > 1) How to use HDFS to read and write? > 2) Is my "scikit-learn" implementation correct? > 3) How to create a Storm project? (Currently working in "storm-starter") > > These questions may sound a bit silly, but I really can't find a proper > solution. > > Thank you for your attention to this matter. > Sincerely, Zharas. > -- Best regards, Zharas --001a11c00ce40526dd052adc0253 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Can anyone help to create a Spout which reads a file from = HDFS?
I have tried with the code below, but it is not working.

public void nextTuple() {
=C2=A0 =C2= =A0 =C2=A0 Path pt=3Dnew Path("hdfs://localhost:50070/user/BCpredict.t= xt");
=C2=A0 =C2=A0 =C2=A0 FileSystem fs =3D FileSystem.get(= new Configuration());
=C2=A0 =C2=A0 =C2=A0 BufferedReader br =3D = new BufferedReader(new InputStreamReader(fs.open(pt)));
=C2=A0 = =C2=A0 =C2=A0 String line =3D br.readLine();
=C2=A0 =C2=A0 =C2=A0= while (line !=3D null){
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0System= .out.println(line);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0line=3Dbr.r= eadLine();
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0_collector.emit(new = Values(line));
=C2=A0 =C2=A0 =C2=A0 }
}

On Tue, F= eb 2, 2016 at 1:19 PM, K Zharas <kgzharas@gmail.com> wrote:=
Hi.=C2=A0

I have a project I'm currently working on. The idea is to impleme= nt "scikit-learn" into Storm and integrate it with HDFS.=C2=A0

I've already implemented "scikit-learn"= ;. But, currently I'm using a text file to read and write. However, I n= eed to use HDFS, but finding it hard to integrate with HDFS.=C2=A0

Here is the link to github. (I only included files th= at I used, not whole project)

Basically, I have a = few questions if you don't mint to answer them
1) How=C2=A0to= use HDFS to read and write?
2) Is my "scikit-learn" im= plementation correct?
3) How to create a Storm project? (Currentl= y working in "storm-starter")

These ques= tions may sound a bit silly, but I really can't find a proper solution.=

Thank you for your attention to this matter.
Sincerely, Zharas.



--
Best regards,
Zharas
=
--001a11c00ce40526dd052adc0253--