From 70cefbac38583844005d2c82ec8a319cb8268849 Mon Sep 17 00:00:00 2001
From: Yngve Inntjore Levinsen <Yngve.Levinsen@esss.se>
Date: Thu, 22 Oct 2015 16:52:05 +0200
Subject: [PATCH] added supporting templates if you have templates head.tmp,
 queue.tmp in running directory then these are used instead..

---
 scripts/tracewin_errorstudy | 56 +++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)

diff --git a/scripts/tracewin_errorstudy b/scripts/tracewin_errorstudy
index 43917df..226a31a 100644
--- a/scripts/tracewin_errorstudy
+++ b/scripts/tracewin_errorstudy
@@ -233,3 +233,59 @@ if __name__=="__main__":
     setup(args)
     ask(args)
     execute(args.calc_dir,args.multi>1)
+
+ # supporting templates..
+
+HEAD_TEMPLATE='''
+universe       = Vanilla
+# Without this, condor does not transfer files to tmp directory, and PWD is submit directory when running on localhost
+should_transfer_files = yes
+initialdir      = {args.calc_dir}/Local_TraceWin_$(Process)
+transfer_input_files = {input_files}
+requirements = ( OpSys == "LINUX" || OpSys == "OSX" )
+log            = condor.log
+executable     = TraceWin_exe/tracewin.$$(OpSys).$$(Arch)
+'''
+HEAD_MULTI_TEMPLATE='''
+universe       = Vanilla
+# Without this, condor does not transfer files to tmp directory, and PWD is submit directory when running on localhost
+should_transfer_files = yes
+initialdir      = {args.calc_dir}/Local_TraceWin_$(Process)
+requirements = ( OpSys == "LINUX" || OpSys == "OSX" )
+log            = condor.log
+executable     = TraceWin_exe/tracewin.$$(OpSys).$$(Arch)
+'''
+
+QUEUE_TEMPLATE='''
+priority = {q_priority}
+arguments      = 1 {stat_study} {rand}
+queue 1
+'''
+
+QUEUE_MULTI_TEMPLATE='''
+initialdir      = {args.calc_dir}/{job_folder}
+transfer_input_files = {input_files}
+priority = {q_priority}
+arguments      = 1 {stat_study} {rand}
+queue 1
+'''
+
+ def get_head_template(filename='head.tmp'):
+     return _get_template(filename,QUEUE_TEMPLATE)
+ def get_head_multi_template(filename='head.multi.tmp'):
+     return _get_template(filename,QUEUE_MULTI_TEMPLATE)
+ def get_queue_template(filename='queue.tmp'):
+     return _get_template(filename,QUEUE_TEMPLATE)
+ def get_queue_multi_template(filename='queue.multi.tmp'):
+     return _get_template(filename,QUEUE_MULTI_TEMPLATE)
+
+ def _get_template(filename, template):
+     '''
+     Only to be used by get_NN_template()
+     '''
+     import os
+
+     if os.path.exists(filename):
+         return file(filename).read()
+     else:
+         return template
-- 
GitLab