Hi Sebastian... problem is that while sending message in superstep 0 ,i am not able to retrieve in superstep 1.. while running the program,program ends with the following details...
13/11/20 15:45:23 INFO job.GiraphJob: run: Tracking URL: http://localhost:50030/jobdetails.jsp?jobid=job_201311200901_0018 13/11/20 15:46:33 INFO job.HaltApplicationUtils$DefaultHaltInstructionsWriter: writeHaltInstructions: To halt after next superstep execute: 'bin/halt-application --zkServer kanha-Vostro-1014:22181 --zkNode /_hadoopBsp/job_201311200901_0018/_haltComputation' 13/11/20 15:46:33 INFO mapred.JobClient: Running job: job_201311200901_0018 13/11/20 15:46:34 INFO mapred.JobClient: map 100% reduce 0% 13/11/20 15:56:20 INFO mapred.JobClient: map 50% reduce 0% 13/11/20 15:56:28 INFO mapred.JobClient: Job complete: job_201311200901_0018 13/11/20 15:56:28 INFO mapred.JobClient: Counters: 6 13/11/20 15:56:28 INFO mapred.JobClient: Job Counters 13/11/20 15:56:28 INFO mapred.JobClient: SLOTS_MILLIS_MAPS=1282572 13/11/20 15:56:28 INFO mapred.JobClient: Total time spent by all reduces waiting after reserving slots (ms)=0 13/11/20 15:56:28 INFO mapred.JobClient: Total time spent by all maps waiting after reserving slots (ms)=0 13/11/20 15:56:28 INFO mapred.JobClient: Launched map tasks=2 13/11/20 15:56:28 INFO mapred.JobClient: SLOTS_MILLIS_REDUCES=0 13/11/20 15:56:28 INFO mapred.JobClient: Failed map tasks=1 For debugging purpose while i am printing System.out.println() statement, in superstep 1 ,it is not printing...It means that control is not entering into Superstep 2... Thanks.... On Wed, Nov 20, 2013 at 3:43 PM, Sebastian Schelter <[email protected] > wrote: > Hi Jyoti, > > the code looks good in general, what error do you get? > > Btw, I have two students of mine implementing closeness centrality on > Giraph, if you want, I can hook you up with them, they are pretty far > with their implementation. > > Best, > Sebastian > > > > On 20.11.2013 10:13, Jyoti Yadav wrote: > > Thanks Sebastian for your reply... > > > > All three files are shown below.. > > > > 1.Main program file.. > > 2.VertexValueWritable file. > > 3.MessageWritable file.. > > > > > > > > > ..................................************************......................................... > > > > > > package org.apache.giraph.examples; > > import org.apache.giraph.examples.utils.ClosenessVertexValueWritable; > > import org.apache.giraph.graph.BasicComputation; > > import org.apache.giraph.conf.LongConfOption; > > import org.apache.giraph.edge.Edge; > > import org.apache.giraph.graph.Vertex; > > import org.apache.hadoop.io.DoubleWritable; > > import org.apache.hadoop.io.FloatWritable; > > import org.apache.hadoop.io.LongWritable; > > import org.apache.log4j.Logger; > > > > import java.io.IOException; > > > > > > public class Closeness extends BasicComputation<LongWritable, > > ClosenessVertexValueWritable, FloatWritable, ClosenessMessageWritable> > > { > > private static final Logger LOG =Logger.getLogger(Closeness.class); > > @Override > > public void compute(Vertex<LongWritable, > > ClosenessVertexValueWritable, FloatWritable> > > vertex,Iterable<ClosenessMessageWritable> messages) throws IOException > > { > > if(getSuperstep()==0) > > { > > boolean[] bitstring=new boolean[128]; > > for(int i=0;i<128;i++) > > { > > bitstring[i]=false; > > } > > vertex.setValue(new > > ClosenessVertexValueWritable(0.0,0.0,bitstring)); > > boolean[] bitstring1=new boolean[128]; > > bitstring1=vertex.getValue().get_previous_bitstring(); > > > > > > for (Edge<LongWritable, FloatWritable> edge : > > vertex.getEdges()) > > { > > > > > > sendMessage(edge.getTargetVertexId(), new > > ClosenessMessageWritable(bitstring)); > > > > System.out.println("superstep is > > ="+getSuperstep()+"vertex is ="+vertex.getId().get()); > > > > > > > > } > > > > } > > > > if(getSuperstep()==1) > > { > > boolean[] bitstring2=new boolean[128]; > > > > for (ClosenessMessageWritable message : messages) > > { > > System.out.println("superstep is > ="+getSuperstep()+"vertex > > is ="+vertex.getId().get()); > > > > > > bitstring2=message.get_previous_bitstring(); > > > > } > > > > > > vertex.voteToHalt(); > > } > > > > > > > > > > > > } > > } > > > > > > > > > .............................................*************************************..................................................... > > > > > > > > package org.apache.giraph.examples.utils; > > > > import java.io.*; > > import org.apache.hadoop.io.Writable; > > import org.apache.hadoop.io.LongWritable; > > import org.apache.hadoop.io.WritableComparator; > > import java.util.Arrays; > > > > > > > > > > > > > > > > > > > > > > public class ClosenessVertexValueWritable implements Writable { > > > > private double vertex_value; > > private double previous_no_of_neighbors; > > private boolean[] previous_bitstring; > > > > public ClosenessVertexValueWritable() > > { > > vertex_value=0.0; > > previous_no_of_neighbors=0.0; > > previous_bitstring=new boolean[128]; > > > > } > > > > public ClosenessVertexValueWritable(double vertex_value1,double > > previous_no_of_neighbors1,boolean[] previous_bitstring1) > > { > > > > vertex_value=vertex_value1; > > previous_no_of_neighbors=previous_no_of_neighbors1; > > previous_bitstring=new boolean[128]; > > previous_bitstring=previous_bitstring1; > > > > > > > > > > public double get_vertex_value() { return vertex_value; } > > public double get_previous_no_of_neighbors() { return > > previous_no_of_neighbors; } > > public boolean[] get_previous_bitstring() { return previous_bitstring; > } > > > > > > @Override > > public void readFields(DataInput in) throws IOException { > > vertex_value=in.readDouble(); > > previous_no_of_neighbors=in.readDouble(); > > > > for(int i=0;i<128;i++) > > { > > this.previous_bitstring[i] = in.readBoolean(); > > } > > } > > @Override > > public void write(DataOutput out) throws IOException { > > out.writeDouble(vertex_value); > > > > out.writeDouble(previous_no_of_neighbors); > > > > for(int i=0;i<128;i++) > > { > > out.writeBoolean(previous_bitstring[i]); > > } > > > > > > } > > > > @Override > > public String toString() > > { > > String str=""; > > > > //str=Arrays.toString(previous_bitstring); > > > > return Double.toString(vertex_value)+ > > > Double.toString(previous_no_of_neighbors)+Arrays.toString(previous_bitstring); > > } > > > > > > > > } > > > > > > > ..................................*****************************************................................................... > > > > > > > > package org.apache.giraph.examples; > > > > import java.io.*; > > import org.apache.hadoop.io.Writable; > > import org.apache.hadoop.io.LongWritable; > > import org.apache.hadoop.io.WritableComparator; > > import java.util.Arrays; > > > > > > public class ClosenessMessageWritable implements Writable { > > > > > > > > private int size; > > > > private boolean[] previous_bitstring; > > > > public ClosenessMessageWritable() {} > > > > public ClosenessMessageWritable(boolean[] previous_bitstring1) > > { > > > > size=128; > > previous_bitstring=new boolean[128]; > > previous_bitstring=previous_bitstring1; > > > > > > > > > > } > > > > > > public boolean[] get_previous_bitstring() { return previous_bitstring; > } > > > > @Override > > public void readFields(DataInput in) throws IOException { > > > > > > size=in.readInt(); > > > > for(int i=0;i<size;i++) > > { > > boolean b=in.readBoolean(); > > previous_bitstring[i] = b; > > } > > > > > > } > > @Override > > public void write(DataOutput out) throws IOException { > > > > out.writeInt(size); > > > > for(int i=0;i<size;i++) > > { > > boolean b=previous_bitstring[i]; > > out.writeBoolean(b); > > } > > > > > > > > } > > > > > > @Override > > public String toString() > > { > > String str=""; > > > > str=Arrays.toString(previous_bitstring); > > > > return str; > > } > > > > > > > > > > } > > > > > > Please check where i am going wrong... > > Thanks... > > > > > > > > On Wed, Nov 20, 2013 at 1:31 PM, Sebastian Schelter < > [email protected] > >> wrote: > > > >> What errors do you exactly get? Can you show the whole implementation of > >> your vertex? > >> > >> On 20.11.2013 08:42, Jyoti Yadav wrote: > >>> Hi folks.. > >>> > >>> I am implementing one program where I need to pass message as boolean > >>> array.. > >>> While implementing my MyMessageWritable.java class,I need to define > >>> readfields() and write() functions... > >>> > >>> I tried my luck but failed...Program is compiling fine but not > running... > >>> > >>> > >>> I am taking boolean array as > >>> > >>> boolean[] bitstring=new boolean[128]; > >>> > >>> > >>> pls help...I am badly tangled... > >>> > >>> Thanks > >>> > >>> Jyoti > >>> > >> > >> > > > >
