You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@singa.apache.org by wa...@apache.org on 2015/07/24 08:56:26 UTC

incubator-singa git commit: SINGA-39 Avoid ssh in scripts for single node environment

Repository: incubator-singa
Updated Branches:
  refs/heads/master c3a248a4b -> e8e592f1e


SINGA-39 Avoid ssh in scripts for single node environment

singa-console.sh
  check local_procs flags before ssh
tool.cc
  change printed job id from job-X to X


Project: http://git-wip-us.apache.org/repos/asf/incubator-singa/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-singa/commit/e8e592f1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-singa/tree/e8e592f1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-singa/diff/e8e592f1

Branch: refs/heads/master
Commit: e8e592f1eddb865e03939affbeaa8ae4a7488caf
Parents: c3a248a
Author: wang sheng <wa...@gmail.com>
Authored: Fri Jul 24 14:53:48 2015 +0800
Committer: wang sheng <wa...@gmail.com>
Committed: Fri Jul 24 14:53:48 2015 +0800

----------------------------------------------------------------------
 bin/singa-console.sh | 12 ++++++++++--
 src/utils/tool.cc    |  4 ++--
 2 files changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/e8e592f1/bin/singa-console.sh
----------------------------------------------------------------------
diff --git a/bin/singa-console.sh b/bin/singa-console.sh
index 9ed3075..8f7cac1 100755
--- a/bin/singa-console.sh
+++ b/bin/singa-console.sh
@@ -65,11 +65,19 @@ case $1 in
              -oUserKnownHostsFile=/dev/null \
              -oLogLevel=quiet"
     hosts=`cat $host_file | cut -d ' ' -f 1`
+    if [ `head -1 "$SINGA_CONF"/hostfile` == localhost ]; then
+      local_procs=1
+    fi
     for i in ${hosts[@]}; do
-      echo kill singa @ $i ...
       proc=(`echo $i | tr '|' ' '`)
       singa_kill="kill -9 "${proc[1]}
-      ssh $ssh_options ${proc[0]} $singa_kill
+      if [ -z $local_procs ]; then
+        echo Kill singa @ $i ...
+        ssh $ssh_options ${proc[0]} $singa_kill
+      else
+        echo Kill singa @ ${proc[1]} ...
+        $singa_kill
+      fi
     done
     rm $host_file
     ./singatool clean $2 || exit 1

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/e8e592f1/src/utils/tool.cc
----------------------------------------------------------------------
diff --git a/src/utils/tool.cc b/src/utils/tool.cc
index 8e35997..60da414 100644
--- a/src/utils/tool.cc
+++ b/src/utils/tool.cc
@@ -45,7 +45,7 @@ int main(int argc, char **argv) {
     printf("----------|-----------\n");
     for (singa::JobInfo job : jobs) {
       if (!job.procs) continue;
-      printf("job-%-6d|%-10d\n", job.id, job.procs);
+      printf("%-10d|%-10d\n", job.id, job.procs);
     }
   } else if (!strcmp(argv[1], "listall")) {
     std::vector<singa::JobInfo> jobs;
@@ -53,7 +53,7 @@ int main(int argc, char **argv) {
     printf("JOB ID    |NUM PROCS  \n");
     printf("----------|-----------\n");
     for (singa::JobInfo job : jobs) {
-      printf("job-%-6d|%-10d\n", job.id, job.procs);
+      printf("%-10d|%-10d\n", job.id, job.procs);
     }
   } else if (!strcmp(argv[1], "view")) {
     if (argc <= 2) {