in slurm-to-batch/convert_to_batch_job.py [0:0]
def main():
if len(sys.argv) != 2 and len(sys.argv) != 3:
print(
'Usage: python3 convert_slurm_batch_job.py <slurm_script_path> <batch_template_folder>(optional)'
)
sys.exit(1)
slurm_script_path = sys.argv[1]
if len(sys.argv) == 2:
# Use the slurm_script_path's folder.
output_dir = os.path.dirname(slurm_script_path)
else:
output_dir = sys.argv[2]
os.makedirs(output_dir, exist_ok=True)
config = SlurmScriptParser.parse_slurm_script(slurm_script_path)
yaml.add_representer(str, str_presenter)
yaml.representer.SafeRepresenter.add_representer(str, str_presenter)
yaml_data = yaml.dump(createJobJSON(config), allow_unicode=True)
yaml_file_path = os.path.join(output_dir, f"{config.job_name}_template.yaml")
with open(yaml_file_path, 'w', encoding='utf-8') as file:
file.write(yaml_data)