#Write parameters for alpha, graph size and cumulative hanging weight
echo $ALPHA > $TEMPDIR/data_.txt
tail –n 1 $TEMPDIR/graph_.txt | awk ‘{print $1+1}’ >> $TEMPDIR/data_.txt
head –n 1 $TEMPDIR/output.txt | awk ‘{print $2}’ >> $TEMPDIR/data_.txt
hadoop fs –rm –r pageout
hadoop fs –rm output.txt
hadoop fs –copyFromLocal $TEMPDIR/output.txt output.txt
hadoop jar /usr/lib/hadoop–mapreduce/hadoop–streaming.jar –D mapred.output.key.comparator.class=org.apache.hadoop.mapred.lib.KeyFieldBasedComparator –D stream.num.map.output.key.fields=1 –D mapred.text.key.comparator.options=-k1n –file $MRDIR/alphaMapper.py –mapper alphaMapper.py –reducer org.apache.hadoop.mapred.lib.IdentityReducer –file $TEMPDIR/data_.txt –input output.txt –output pageout
if [[ $? != 0 ]]; then
echo “Run unsuccessful!”
exit $?
fi
rm –rf $TEMPDIR/pageout
hadoop fs –copyToLocal pageout $TEMPDIR
cat $TEMPDIR/pageout/part* > $TEMPDIR/out.txt
rm $TEMPDIR/graph_.txt
paste $TEMPDIR/out.txt $TEMPDIR/adja.txt > $TEMPDIR/graph_.txt
done
cat $TEMPDIR/graph_.txt | sort –k2g | head –n 10
if [[ $CLEANUP == 1 ]]; then
rm –rf $TEMPDIR
fi
Kommentare (1)