Skip to content

Commit

Permalink
Merge pull request #40 from JaimeCernuda/master
Browse files Browse the repository at this point in the history
pbs as script
  • Loading branch information
JaimeCernuda authored Oct 17, 2023
2 parents f0484b0 + 36fcba0 commit 52b83b6
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions jarvis_util/shell/pbs_exec.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}'
Expand Down Expand Up @@ -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:
Expand All @@ -90,7 +99,7 @@ class PbsExecInfo(ExecInfo):
def __init__(self, **kwargs):
super().__init__(exec_type=ExecType.PBS, **kwargs)
allowed_options = ['interactive', 'nnodes', 'system', 'filesystems',
'walltime', 'account', 'queue', 'env_vars']
'walltime', 'account', 'queue', 'env_vars', 'bash_script']
self.keys += allowed_options
# We use output and error file from the base Exec Info
for key in allowed_options:
Expand Down

0 comments on commit 52b83b6

Please sign in to comment.