diff --git a/jarvis_util/shell/pbs_exec.py b/jarvis_util/shell/pbs_exec.py index d4fce2e..e7d3d6b 100644 --- a/jarvis_util/shell/pbs_exec.py +++ b/jarvis_util/shell/pbs_exec.py @@ -32,6 +32,8 @@ def __init__(self, cmd, exec_info): self.queue = exec_info.queue self.env_vars = exec_info.env_vars + self.bash_script = exec_info.bash_script + jarvis_comma_list = ','.join(exec_info.basic_env.keys()) if self.env_vars: self.env_vars = f'{self.env_vars},{jarvis_comma_list}' @@ -75,10 +77,17 @@ def generate_qsub_command(self): if value is not None: cmd += f' -{option} {value}' - cmd += f' -- \"{self.cmd}\"' + cmd += f' -- \"{self.bash_script}\"' return cmd def pbscmd(self): + + script = ['#!/bin/bash', + f'{self.cmd}'] + + with open(self.bash_script, encoding='utf-8') as f: + f.write('\n'.join(script)) + cmd = self.generate_qsub_command() jutil = JutilManager.get_instance() if jutil.debug_pbs: