Skip to content

Commit

Permalink
Export environment variables and check shell requirements for postscr…
Browse files Browse the repository at this point in the history
…ipts
  • Loading branch information
blimlim committed Jul 26, 2024
1 parent e9bd1f4 commit d1a7473
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions payu/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
from payu.fsops import mkdir_p, make_symlink, read_config, movetree
from payu.fsops import list_archive_dirs
from payu.fsops import run_script_command
from payu.fsops import needs_subprocess_shell
from payu.schedulers.pbs import get_job_info, pbs_env_init, get_job_id
from payu.models import index as model_index
import payu.profilers
Expand Down Expand Up @@ -826,16 +827,21 @@ def profile(self):

def postprocess(self):
"""Submit any postprocessing scripts or remote syncing if enabled"""

# First submit postprocessing script
if self.postscript:
self.set_userscript_env_vars()
envmod.setup()
envmod.module('load', 'pbs')

cmd = 'qsub {script}'.format(script=self.postscript)

cmd = shlex.split(cmd)
sp.check_call(cmd)
if needs_subprocess_shell(cmd):
sp.check_call(cmd, shell=True)
else:
sp.check_call(shlex.split(cmd))


# Submit a sync script if remote syncing is enabled
sync_config = self.config.get('sync', {})
syncing = sync_config.get('enable', False)
Expand Down

0 comments on commit d1a7473

Please sign in to comment.