From 9a86ffd07caa40fc7b6e248f2cbe3070b141eb78 Mon Sep 17 00:00:00 2001
From: Wouter Peters <wouter.peters@wur.nl>
Date: Wed, 8 Sep 2010 15:06:20 +0000
Subject: [PATCH] added non-blocking option for submitting next cycle

---
 da/platform/jet.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/da/platform/jet.py b/da/platform/jet.py
index d1467c80..3e0ba3eb 100755
--- a/da/platform/jet.py
+++ b/da/platform/jet.py
@@ -27,7 +27,7 @@ class JetPlatForm(PlatForm):
         msg2  = '%s version: %s'%(self.Identifier,self.Version) ; logging.debug(msg2)
 
 
-    def GetJobTemplate(self,joboptions={}):
+    def GetJobTemplate(self,joboptions={},block=False):
         """ Return the job template for a given computing system, and fill it with options from the dictionary provided as argument"""
 
         template = """#$ -N jobname \n"""+ \
@@ -37,13 +37,15 @@ class JetPlatForm(PlatForm):
                    """#$ -S jobshell \n"""+ \
                    """#$ -o joblog \n"""+ \
                    """#$ -cwd\n"""+ \
-                   """#$ -sync y\n"""+ \
                    """#$ -r n\n"""+ \
                    """#$ -j y\n"""
 
         if 'depends' in joboptions:
             template += """#$ -hold_jid depends \n"""
 
+        if block:
+            template += """#$ -sync y\n"""
+
         # First replace from passed dictionary
         for k,v in joboptions.iteritems():
             while k in template:
@@ -67,9 +69,9 @@ class JetPlatForm(PlatForm):
         
         cmd     = ['qsub',jobfile]
         output  = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0]  ; logging.info(output)
-        retcode = output.split()[-1][0]
+        retcode = output.split()[-1]
 
-        msg                     = 'Job completed with return code %s'%retcode ; logging.debug(msg)
+        msg                     = 'Job returned: %s'%retcode ; logging.debug(msg)
 
         return retcode
 
-- 
GitLab