SINGA-21 Code Review add cpplint tool
Project: http://git-wip-us.apache.org/repos/asf/incubator-singa/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-singa/commit/0f3a8ff4 Tree: http://git-wip-us.apache.org/repos/asf/incubator-singa/tree/0f3a8ff4 Diff: http://git-wip-us.apache.org/repos/asf/incubator-singa/diff/0f3a8ff4 Branch: refs/heads/master Commit: 0f3a8ff4827d927a0d05b6dc23c2647530aa0f2e Parents: a32102e Author: wang sheng <[email protected]> Authored: Sat Jun 20 19:20:06 2015 +0800 Committer: wang sheng <[email protected]> Committed: Sat Jun 20 19:20:06 2015 +0800 ---------------------------------------------------------------------- script/graph.py | 22 - script/node.sh | 71 - tool/cpplint.py | 6323 ++++++++++++++++++++++++++++++++++++++++++++++++++ tool/graph.py | 22 + tool/node.sh | 71 + 5 files changed, 6416 insertions(+), 93 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/0f3a8ff4/script/graph.py ---------------------------------------------------------------------- diff --git a/script/graph.py b/script/graph.py deleted file mode 100644 index 17aaea7..0000000 --- a/script/graph.py +++ /dev/null @@ -1,22 +0,0 @@ -import sys -import pygraphviz -import networkx as nx -from networkx.readwrite import json_graph -import json - - -if __name__=='__main__': - print sys.argv - if len(sys.argv)<3: - print 'usage: draw the network graph\npython graph.py JSON_DAT FIG_FILE' - sys.exit() - - with open(sys.argv[1]) as fd: - nodelink=json.load(fd) - G=json_graph.node_link_graph(nodelink) - A = nx.to_agraph(G) - A.layout('dot', args='-Nfontsize=10 -Nwidth=".2" -Nheight=".2" -Nmargin=0 \ - -Gfontsize=8') - A.draw(sys.argv[2]) - - http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/0f3a8ff4/script/node.sh ---------------------------------------------------------------------- diff --git a/script/node.sh b/script/node.sh deleted file mode 100755 index 74e0d8a..0000000 --- a/script/node.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/bash -if [[ $# < 2 || ! -f $2 ]] -then - echo "Usage: process/folder management" - echo "[cat, create, delete, kill, ls, ps, reset, scp, ssh] hostfile [args]" - echo " cat hostfile file--- cat the file on every node in hostfile" - echo " create hostfile folder--- create the folder on every node in hostfile" - echo " delete hostfile folder--- delete the folder on every node in hostfile" - echo " kill hostfile job_name--- kill the job on every node in hostfile" - echo " ls hostfile folder--- list the folder on every node in hostfile" - echo " ps hostfile job_name--- ps aux|grep job_name on every node in hostfile" - echo " reset hostfile folder--- delete and create the folder on every node in hostfile" - echo " scp hostfile local_dir [remote_dir]--- copy the local_dir to remote_dir on every node in hostfile, if remote_dir is omitted, remote_dir=local_dir" - echo " ssh hostfile--- test whether the nodes in hostfile are alive" - echo "each line in hostfile is a node name followed by a space and other fields" - exit -fi - -ssh_options="-oStrictHostKeyChecking=no \ --oUserKnownHostsFile=/dev/null \ --oLogLevel=quiet" - -hosts=(`cat $2 |cut -d ' ' -f 1`) - -for i in ${hosts[@]} -do - if [ $1 == "cat" ] - then - cmd="cat $3" - elif [ $1 == "create" -o $1 == "reset" ] - then - cmd="mkdir -p $3" - elif [ $1 == "delete" -o $1 == "reset" ] - then - cmd="rm -rf $3" - elif [ $1 == "kill" ] - then - cmd="ps ax|pgrep $3 |xargs kill" - elif [ $1 == "ls" ] - then - cmd="ls -l $3" - elif [ $1 == "scp" ] - then - local_dir=$3 - remote_dir=$3 - if [ $# -eq 4 ] - then - remote_dir=$4 - fi - r='' - if [[ -d $3 ]] - then - r='-r' - fi - echo "scp $r $local_dir $i:$remote_dir" - scp $r $local_dir $i:$remote_dir - elif [ $1 == "ssh" ] - then - cmd="exit" - elif [ $1 == "ps" ] - then - cmd="ps ax|pgrep $3" - else - echo "Incorrect commands:" $1 - fi - if [ $1 != "scp" ] - then - echo $cmd - ssh $i $cmd - fi -done
