Ejemplo n.º 1
0
 def _writeScript(self, template, parameter_configs, file_prefix):
   """
   Format the template with provided parameter configurations and save locally for reference
   """
   script = Template(template).safe_substitute(ParameterConfig.configsToDict(parameter_configs))
   script_path = f'{self.templated_scripts_dir}/{file_prefix}_{self.experiment.tool_name}_{int(time.time())}.sh'
   with open(script_path, "w") as f:
     f.write(script)
   return script_path, script
Ejemplo n.º 2
0
 def _parameterConfigToString(self, parameter_configs):
     """
     transfer parameter configuration into string for hash
     {A: 10, B: 100} ==> '#A#10#B#100'
     """
     cur_config = ''
     for key, value in ParameterConfig.configsToDict(parameter_configs).items():
         cur_config += f'#{key}#{value}'
     return cur_config