diff --git a/maestrowf/interfaces/script/localscriptadapter.py b/maestrowf/interfaces/script/localscriptadapter.py index 1465fe9a1..f3e46f1f6 100644 --- a/maestrowf/interfaces/script/localscriptadapter.py +++ b/maestrowf/interfaces/script/localscriptadapter.py @@ -40,11 +40,10 @@ class LocalScriptAdapter(ScriptAdapter): + """A ScriptAdapter class for interfacing for local execution.""" + key = "local" - """ - A ScriptAdapter class for interfacing for local execution. - """ def __init__(self, **kwargs): """ Initialize an instance of the LocalScriptAdapter. diff --git a/maestrowf/interfaces/script/slurmscriptadapter.py b/maestrowf/interfaces/script/slurmscriptadapter.py index f79be5d0e..554dbb44d 100644 --- a/maestrowf/interfaces/script/slurmscriptadapter.py +++ b/maestrowf/interfaces/script/slurmscriptadapter.py @@ -109,7 +109,7 @@ def get_header(self, step): batch_header["job-name"] = step.name.replace(" ", "_") batch_header["comment"] = step.description.replace("\n", " ") - modified_header = [self._exec] + modified_header = ["#!{}".format(self._exec)] for key, value in self._header.items(): # If we're looking at the bank and the reservation header exists, # skip the bank to prefer the reservation. @@ -335,27 +335,22 @@ def _write_script(self, ws_path, step): fname = "{}.slurm.sh".format(step.name) script_path = os.path.join(ws_path, fname) - with open(script_path, "w") as script: - if to_be_scheduled: - script.write(self.get_header(step)) - else: - script.write(self._exec) - cmd = "\n\n{}\n".format(cmd) - script.write(cmd) + if to_be_scheduled: + header = self.get_header(step) + else: + header = "#!{}".format(self._exec) + + form_cmd = cmd = "{0}\n\n{1}\n" + with open(script_path, "w") as script: + script.write(form_cmd.format(header, cmd)) if restart: rname = "{}.restart.slurm.sh".format(step.name) restart_path = os.path.join(ws_path, rname) with open(restart_path, "w") as script: - if to_be_scheduled: - script.write(self.get_header(step)) - else: - script.write(self._exec) - - cmd = "\n\n{}\n".format(restart) - script.write(cmd) + script.write(form_cmd.format(header, restart)) else: restart_path = None