From adfc40310975de9fba3e431388d026f435b2768e Mon Sep 17 00:00:00 2001
From: Luc Papeleux <L.Papeleux@ULiege.be>
Date: Wed, 2 Nov 2022 14:24:43 +0100
Subject: [PATCH] fix batch atrm / kill scripts

---
 parametricJob.py | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/parametricJob.py b/parametricJob.py
index 95d7d01..3f2af1b 100644
--- a/parametricJob.py
+++ b/parametricJob.py
@@ -326,24 +326,24 @@ class ParametricJob(PRMSet):
             if m:
                 #cfgFileName, cfgFileExtension = os.path.splitext(self.cfgfile)
                 #os.system("cp %s %s%s%s"%(self.cfgfile, cfgFileName, batchId, cfgFileExtension))
-                self.atrmScript(batchId)
+                self.atrmScript(batchId, launchId)
                 print("\tuse 'atq' and find job number %s to check the status of your job" % batchId)
                 print("\t\t - 'a' means waiting in the queue 'a'")
                 print("\t\t - '=' means running")
                 print("\tuse 'atrm %s to kill the job" % batchId)
-                print("\t\t  or 'atrm%s.py' to kill the job" % batchId)
+                print("\t\t  or 'atrm%s.py' to kill the job" % launchId)
         # to avoid closing the gui
         if not (re.match(r'(.+)Gui.pyw', sys.argv[0])): 
             sys.exit()
 
-    def atrmScript(self, pid):
-        filename = "atrm%s.py"%pid
+    def atrmScript(self, batchId, launchId):
+        filename = "atrm%s.py"%launchId
         file=open(filename,"w")
         file.write("#!/usr/bin/env python\n")
         file.write("import os\n")
-        file.write("os.system('atrm %s')\n" % pid)
-        file.write("if os.path.isfile('kill%s.py'):\n" % pid)
-        file.write("\texecfile('kill%s.py')\n" % pid)
+        file.write("os.system('atrm %s')\n" % batchId)
+        file.write("if os.path.isfile('kill%s.py'):\n" % launchId)
+        file.write("\texecfile('kill%s.py')\n" % launchId)
         file.close()
         os.chmod(filename,0o700)
 
-- 
GitLab