Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add environment variables and shell checks for postscripts #467

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 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,15 +827,19 @@ 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', {})
Expand Down
Loading