Index: /trunk/CHANGES
===================================================================
--- /trunk/CHANGES	(revision 281)
+++ /trunk/CHANGES	(revision 282)
@@ -4,4 +4,14 @@
 
    Author: Willem Vermin (SARA) & Bas van der Vlies 
+
+ * added an example: pbs_jobmonitor shows the output of top 
+   -u user on the node
+    - one cycle of top
+    - user: the user the job belongs to
+
+   renamed as pbs_joblogin logs in to the node as the user 
+   who invokes this script (os.getenv('USER'))
+
+   Author: Willem Vermin (SARA)
   
 =========== 4.3.3
Index: /trunk/README
===================================================================
--- /trunk/README	(revision 281)
+++ /trunk/README	(revision 282)
@@ -1,10 +1,10 @@
 the latest stable pbs_python interface is available from:
-	ftp://ftp.sara.nl/pub/outgoing/pbs_python.tar.gz
+    ftp://ftp.sara.nl/pub/outgoing/pbs_python.tar.gz
 
 Information, documentation and reporting bugs for the package:
-	https://subtrac.sara.nl/oss/pbs_python
+    https://subtrac.sara.nl/oss/pbs_python
 
 bug resport:
-	pbs_python add sara dot nl
+    pbs_python@sara.nl
 
 =============== Brief description =============================
@@ -58,11 +58,18 @@
 sara_nodes.py    - We use this program to set the nodes offline/online. when 
                    there are no command line arguments. It will list the 
-		   nodes that are down/oflline. For more info see:
-		    - https://subtrac.sara.nl/oss/pbs_python/wiki/TorqueExamples
+                   nodes that are down/oflline. For more info see:
+                    - https://subtrac.sara.nl/oss/pbs_python/wiki/TorqueExamples
+
+pbs_jobmonitor   - Shows the output of top -u user on the node:
+                     * one cycle of top
+                     * user: the user the job belongs to
+
+pbs_joblogin     - logs in to the node as the user who invokes this script 
+                   (os.getenv('USER'))
 
 For more info about SARA see:
-	http://www.sara.nl/index_eng.html
-	
+    http://www.sara.nl/index_eng.html
 
+--
 ********************************************************************
 *                                                                  *
Index: /trunk/debian/changelog
===================================================================
--- /trunk/debian/changelog	(revision 281)
+++ /trunk/debian/changelog	(revision 282)
@@ -2,4 +2,5 @@
 
   * See CHANGES 
+  * install pbs_jobmonitor and pbs_joblogin in /usr/bin
 
  -- Bas van der Vlies <basv@sara.nl>  Fri, 27 Apr 2012 09:54:54 +0200
Index: /trunk/debian/rules
===================================================================
--- /trunk/debian/rules	(revision 281)
+++ /trunk/debian/rules	(revision 282)
@@ -18,2 +18,4 @@
 	install -D examples/new_rack_pbsmon.py debian/pbs-python/usr/bin/pbsmon
 	install -D examples/sara_nodes.py debian/pbs-python/usr/bin/sara_nodes
+	install -D examples/pbs_jobmonitor debian/pbs-python/usr/bin/pbs_jobmonitor
+	install -D examples/pbs_jobmonitor debian/pbs-python/usr/bin/pbs_joblogin
Index: /trunk/examples/README
===================================================================
--- /trunk/examples/README	(revision 281)
+++ /trunk/examples/README	(revision 282)
@@ -1,6 +1,6 @@
 To test these utilities set the environment variabele PYTHONPATH:
 for sh-shells:
-	PYTHONPATH=../src; export PYTHONPATH
+    PYTHONPATH=../src; export PYTHONPATH
 
 for csh-shells:
-	setenv PYTHONPATH ../src
+    setenv PYTHONPATH ../src
Index: /trunk/examples/pbs_jobmonitor
===================================================================
--- /trunk/examples/pbs_jobmonitor	(revision 282)
+++ /trunk/examples/pbs_jobmonitor	(revision 282)
@@ -0,0 +1,120 @@
+#!/usr/bin/env python
+# 
+# Author:
+#  Willem Vermin, SARA, April 2012
+#
+# SVN Info:
+#   $Id#
+#   $URL$
+#
+# pbs_jobmonitor, pbs_joblogin <jobnr> [nodenr]
+#    jobnr: the number of the job
+#    nodenr: the rank of the node in the job
+#
+# depending on the name with this script is called it performs the
+# following:
+
+# called as pbs_jobmonitor:
+#       shows the output of top -u user on the node
+#       - one cycle of top
+#       - user: the user the job belongs to
+#
+# called as pbs_joblogin:
+#       logs in to the node as the user who invokes this script
+#            (os.getenv('USER'))
+#
+from PBSQuery import PBSQuery
+import sys,os
+def uniq(seq, idfun=None): 
+  # http://www.peterbe.com/plog/uniqifiers-benchmark
+   # order preserving
+   if idfun is None:
+       def idfun(x): return x
+   seen = {}
+   result = []
+   for item in seq:
+       marker = idfun(item)
+       if marker in seen: continue
+       seen[marker] = 1
+       result.append(item)
+   return result
+
+def usage(a):
+  if a == 'pbs_jobmonitor':
+    print a,'shows the system usage of a node where a job is running'
+  if a == 'pbs_joblogin':
+    print a,'logs you in to a node where a job is running'
+    
+  print 'Usage:'
+  print a,'<jobnumber> [nodenumber]'
+  print 'where <jobnumber> is the number of the job'
+  print '      nodenumber is the rank number of the node allocated to the job'
+  print '      (default 0)'
+  
+me = sys.argv[0].split('/')[-1]
+print '['+me+']'
+p = PBSQuery()
+
+try:
+  j=sys.argv[1]
+except:
+  usage(me)
+  sys.exit(1)
+
+# check if numerical jobnumber. (Be aware: dependecy jobs have a '-')
+try:
+  nj = int(j.split('.')[0].split('-')[0]) 
+except:
+  usage(me)
+  sys.exit(1)
+
+if len(sys.argv) > 2:
+  try:
+    num = int(sys.argv[2])
+  except:
+    usage(me)
+    sys.exit(1)
+else:
+  num = 0
+
+job = p.getjob(j)
+
+try:
+  h = job['exec_host'][0]
+except:
+  print 'No such job:',j
+  sys.exit(1)
+
+hh = h.split('+')
+nodes=[]
+for h in hh:
+  nodes = nodes + [ h.split('/')[0]]
+
+nodes = uniq(nodes)
+print 'Job',j,'is running on',len(nodes),'nodes:'
+i=0
+for h in nodes:
+  print h,
+  i = i+1
+  if i > 7:
+    i=0
+    print
+if i != 0:
+  print
+
+if num >= len(nodes):
+  print 'No node number',num
+  sys.exit(1)
+
+if me == 'pbs_jobmonitor':
+  user=job['Job_Owner'][0].split('@')[0]
+  print 'top for node #',num,':',nodes[num],'user:',user
+  sys.stdout.flush()
+  os.system('ssh '+nodes[num]+' top -n1 -b -u ' + user)
+
+if me == 'pbs_joblogin':
+  user = os.getenv('USER')
+  print 'logging in to node #',num,':',nodes[num],'user:',user
+  sys.stdout.flush()
+  os.system('ssh -X '+nodes[num])
+
Index: unk/examples/topjob
===================================================================
--- /trunk/examples/topjob	(revision 281)
+++ 	(revision )
@@ -1,119 +1,0 @@
-#!/usr/bin/env python
-# 
-# Author:
-#  Willem Vermin, SARA, April 2012
-#
-# SVN Info:
-#   $Id#
-#   $URL$
-#
-# topjob, gojob jobnr [nodenr]
-#               jobnr: the number of the job
-#               nodenr: the rank of the node in the job
-# depending on the name with this script is called it performs the
-# following:
-
-# called as topjob:
-#       shows the output of top -u user on the node
-#       - one cycle of top
-#       - user: the user the job belongs to
-#
-# called as gojob:
-#       logs in to the node as the user who invokes this script
-#            (os.getenv('USER'))
-#
-from PBSQuery import PBSQuery
-import sys,os
-def uniq(seq, idfun=None): 
-  # http://www.peterbe.com/plog/uniqifiers-benchmark
-   # order preserving
-   if idfun is None:
-       def idfun(x): return x
-   seen = {}
-   result = []
-   for item in seq:
-       marker = idfun(item)
-       if marker in seen: continue
-       seen[marker] = 1
-       result.append(item)
-   return result
-
-def usage(a):
-  if a == 'gojob':
-    print a,'logs you in to a node where a job is running'
-  if a == 'topjob':
-    print a,'shows the system usage of a node where a job is running'
-    
-  print 'Usage:'
-  print a,'jobnumber [nodenumber]'
-  print 'where jobnumber is the number of the job'
-  print '      nodenumber is the rank number of the node allocated to the job'
-  print '      (default 0)'
-  
-me = sys.argv[0].split('/')[-1]
-print '['+me+']'
-p = PBSQuery()
-
-try:
-  j=sys.argv[1]
-except:
-  usage(me)
-  sys.exit(1)
-
-# check if numerical jobnumber. (Be aware: dependecy jobs have a '-')
-try:
-  nj = int(j.split('.')[0].split('-')[0]) 
-except:
-  usage(me)
-  sys.exit(1)
-
-if len(sys.argv) > 2:
-  try:
-    num = int(sys.argv[2])
-  except:
-    usage(me)
-    sys.exit(1)
-else:
-  num = 0
-
-job = p.getjob(j)
-
-try:
-  h = job['exec_host'][0]
-except:
-  print 'No such job:',j
-  sys.exit(1)
-
-hh = h.split('+')
-nodes=[]
-for h in hh:
-  nodes = nodes + [ h.split('/')[0]]
-
-nodes = uniq(nodes)
-print 'Job',j,'is running on',len(nodes),'nodes:'
-i=0
-for h in nodes:
-  print h,
-  i = i+1
-  if i > 7:
-    i=0
-    print
-if i != 0:
-  print
-
-if num >= len(nodes):
-  print 'No node number',num
-  sys.exit(1)
-
-if me == 'topjob':
-  user=job['Job_Owner'][0].split('@')[0]
-  print 'top for node #',num,':',nodes[num],'user:',user
-  sys.stdout.flush()
-  os.system('ssh '+nodes[num]+' top -n1 -b -u ' + user)
-
-if me == 'gojob':
-  user = os.getenv('USER')
-  print 'logging in to node #',num,':',nodes[num],'user:',user
-  sys.stdout.flush()
-  os.system('ssh -X '+nodes[num])
-
