def generate_submit_scripts_from_yaml (args): #print "Generating submission script using yaml file" bpy = skel_bpy.skel_bpy (args.yamlfile) outfilename = "submit.pbs" template_file_name = "~/.skel/templates/submit_sith.tmpl" # Only proceed if outfilename does not already exist, or if -f was used if os.path.exists (outfilename) and not args.force: print "%s exists, aborting. Delete the file or use -f to overwrite." % outfilename return 999 skel_file = open (outfilename, 'w') # Now for the Cheetah magic: from Cheetah.Template import Template template_file = open (os.path.expanduser(template_file_name), 'r') t = Template(file=template_file) settings = skel_settings.skel_settings() t.bpy = bpy t.project = args.project t.target = settings.get_submit_target() t.account = settings.get_account() t.job_name = "skel_%s_%d" % (args.project, bpy.get_num_procs() ) t.walltime = "1:00:00" t.iteration_count = 1 t.executable = "%s_skel_%s" % (t.project, bpy.get_group_name() ) skel_file.write (str(t) )
def generate_submit_scripts_from_xml(params): settings = skel_settings.skel_settings() for batch in params.get_batches(): #platform = params.get_target() settings = skel_settings.skel_settings() platform = settings.get_submit_target() sfile = open('submit_' + platform + '_' + batch.get_name(), 'w') sfile_template = open( os.path.expanduser('~/.skel/templates/submit_' + platform + '.tpl'), 'r') i = 0 template_lines = sfile_template.readlines() while i < len(template_lines): template_line = template_lines[i] if '$$START_TEST$$' in template_line: # This is the test macro, run through it for each test template_start_index = i + 1 for test in batch.get_tests(): j = template_start_index template_line = template_lines[j] while not '$$END_TEST$$' in template_line: sfile.write( submit_line_template_replace( template_line, params, batch, test, settings)) j = j + 1 template_line = template_lines[j] # Point at the first line after the macro i = j + 1 else: # Fill in any replacement vars in this line... template_line = submit_line_template_replace( template_line, params, batch, None, settings) sfile.write(template_line) i = i + 1 sfile_template.close() sfile.close()
def generate_submit_scripts_from_xml (params): settings = skel_settings.skel_settings() for batch in params.get_batches(): #platform = params.get_target() settings = skel_settings.skel_settings() platform = settings.get_submit_target() sfile = open ('submit_' + platform + '_' + batch.get_name(), 'w') sfile_template = open (os.path.expanduser('~/.skel/templates/submit_' + platform + '.tpl'), 'r') i = 0 template_lines = sfile_template.readlines() while i < len (template_lines): template_line = template_lines[i] if '$$START_TEST$$' in template_line: # This is the test macro, run through it for each test template_start_index = i + 1 for test in batch.get_tests(): j = template_start_index template_line = template_lines[j] while not '$$END_TEST$$' in template_line: sfile.write (submit_line_template_replace (template_line, params, batch, test, settings)) j = j + 1 template_line = template_lines[j] # Point at the first line after the macro i = j + 1 else: # Fill in any replacement vars in this line... template_line = submit_line_template_replace (template_line, params, batch, None, settings) sfile.write (template_line) i = i + 1 sfile_template.close() sfile.close()
def generate_makefiles_c(params): platform = params.get_target() settings = skel_settings.skel_settings() makefile = open('Makefile', 'w') # Makefile generation no longer depends on the target, just using default here. #makefile_template_name = os.path.dirname (sys.argv[0]) + '/../etc/skel/templates/Makefile.' + platform + '.tpl' makefile_template_name = os.path.dirname( sys.argv[0]) + '/../etc/skel/templates/Makefile.default.tpl' makefile_template = open(os.path.expanduser(makefile_template_name), 'r') include_statement = "" + os.path.dirname( sys.argv[0]) + '/../etc/skel/compiler_fragment.mk' bindir = os.path.abspath(os.path.dirname(sys.argv[0])) for template_line in makefile_template: # Fill in any replacement vars in this line... template_line = template_line.replace('$$ADIOS_BIN_DIR$$', bindir) template_line = template_line.replace('$$APP$$', params.get_application()) template_line = template_line.replace('$$INCLUDE$$', include_statement) template_line = template_line.replace('$$TARGET$$', platform) template_line = template_line.replace('$$DEPLOY_DIR$$', settings.get_deploy_dir()) template_line = template_line.replace( '$$CORES_USED$$', '%d' % params.get_batches()[0].get_cores()) if '$$FTESTS$$' in template_line: template_line = template_line.replace('$$FTESTS$$', '') if '$$CTESTS$$' in template_line: test_string = '' test_set = set() for batch in params.get_batches(): for test in batch.get_tests(): test_set.add(params.get_application() + '_skel_' + test.get_group_name() + '_' + test.get_type() + ' ') for t in test_set: test_string = test_string + t template_line = template_line.replace('$$CTESTS$$', test_string) makefile.write(template_line)
def generate_makefiles_c (params): platform = params.get_target() settings = skel_settings.skel_settings() makefile = open ('Makefile', 'w') # Makefile generation no longer depends on the target, just using default here. #makefile_template_name = os.path.dirname (sys.argv[0]) + '/../etc/skel/templates/Makefile.' + platform + '.tpl' makefile_template_name = os.path.dirname (sys.argv[0]) + '/../etc/skel/templates/Makefile.default.tpl' makefile_template = open(os.path.expanduser(makefile_template_name), 'r') include_statement = "" + os.path.dirname (sys.argv[0]) + '/../etc/skel/compiler_fragment.mk' bindir = os.path.abspath(os.path.dirname(sys.argv[0])) for template_line in makefile_template: # Fill in any replacement vars in this line... template_line = template_line.replace ('$$ADIOS_BIN_DIR$$', bindir) template_line = template_line.replace ('$$APP$$', params.get_application () ) template_line = template_line.replace ('$$INCLUDE$$', include_statement) template_line = template_line.replace ('$$TARGET$$', platform) template_line = template_line.replace ('$$DEPLOY_DIR$$', settings.get_deploy_dir()) template_line = template_line.replace ('$$CORES_USED$$', '%d'%params.get_batches()[0].get_cores()) if '$$FTESTS$$' in template_line: template_line = template_line.replace ('$$FTESTS$$', '') if '$$CTESTS$$' in template_line: test_string = '' test_set = set() for batch in params.get_batches(): for test in batch.get_tests(): test_set.add (params.get_application() + '_skel_' + test.get_group_name() + '_' + test.get_type() + ' ') for t in test_set: test_string = test_string + t template_line = template_line.replace ('$$CTESTS$$', test_string) makefile.write (template_line)
def __init__ (self, measure_string): self.settings_dict = skel_settings.skel_settings().get_settings_dict() self.measure_string = measure_string
def __init__(self, measure_string): self.settings_dict = skel_settings.skel_settings().get_settings_dict() self.measure_string = measure_string