Johannes Köster  committed 9f7e1bb

Fixed read_job_properties to work with "=" in params.

  • Participants
  • Parent commits c96292d

Comments (0)

Files changed (3)

File snakemake/

         raise ValueError(self.errormsg)
-def read_job_properties(jobscript, prefix="# properties"):
+def read_job_properties(jobscript, prefix="# properties", pattern=re.compile("# properties = (.*)")):
     """Read the job properties defined in a snakemake jobscript.
     This function is a helper for writing custom wrappers for the snakemake --cluster functionality. Applying this function to a jobscript will return a dict containing information about the job.
     with open(jobscript) as jobscript:
-        for l in jobscript:
-            if l.startswith(prefix):
-                return json.loads(l.split("=")[1])
+        for m in map(pattern.match, jobscript):
+            if m:
+                return json.loads(

File tests/test14/Snakefile.nonstandard

 rule compute2:
 	input: '{name}.{chromosome}.inter'
 	output: '{name}.{chromosome}.inter2'
+	params: test="a=b"
 	shell: 'echo copy; cp {input[0]} {output[0]}'
 rule gather:

File tests/test14/

 jobscript = sys.argv[1]
 job_properties = read_job_properties(jobscript)
-with open("qsub.log", "w") as log:
+with open("qsub.log", "a") as log:
     print(job_properties, file=log)
 print(random.randint(1, 100))