Skip to content

Commit

Permalink
make batch script executable
Browse files Browse the repository at this point in the history
  • Loading branch information
maurov committed Jul 31, 2024
1 parent a1f7934 commit 91497a4
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions larch/xrd/struct2xas.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

# main imports
import os
import stat
import json
import time
from dataclasses import dataclass
Expand Down Expand Up @@ -1014,12 +1015,18 @@ def make_sbatch(self, template: str, **kwargs):
"""
assert os.path.isfile(template), "wrong template path"
with open(os.path.join(self.outdir, "job.sbatch"), "w") as fp, open(
template
) as tp:
batch_script = os.path.join(self.outdir, "job.sbatch")
with open(batch_script, "w") as fp, open(template) as tp:
fp.write(tp.read().format(**kwargs))
logger.info(f"written {fp.name}")

# Make the SLURM batch script executable.
current_permissions = os.stat(batch_script)
os.chmod(
batch_script,
current_permissions.st_mode | stat.S_IEXEC | stat.S_IXGRP | stat.S_IXOTH,
)

def make_input_feff(
self,
parent_path: str = None,
Expand Down

0 comments on commit 91497a4

Please sign in to comment.