Skip to content

Commit

Permalink
ShellcmdLrms: Raise SpoolDirError in case working directory cannot …
Browse files Browse the repository at this point in the history
…be created.
  • Loading branch information
riccardomurri committed Aug 14, 2018
1 parent 0dfce16 commit 92e4203
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions gc3libs/backends/shellcmd.py
Expand Up @@ -1367,19 +1367,19 @@ def _setup_app_execution_directory(self, app):
"""
Create a temporary subdirectory and return its (remote) path.
This is intended to be used as part of the "submit" process; in case of
failure it will raise an `LRMSSubmitError`.
This is intended to be used as part of the "submit" process;
in case of any failure, raises a `SpoolDirError`.
"""
target = posixpath.join(self.spooldir, 'gc3libs.XXXXXX')
exit_code, stdout, stderr = self.transport.execute_command(
"mkdir -pv {0} && mktemp -d {1}".format(
os.path.abspath(dirname(target)), target))
target = posixpath.join(self.spooldir, 'shellcmd_job.XXXXXX')
cmd = ("mkdir -pv {0} && mktemp -d {1}"
.format(os.path.abspath(dirname(target)), target))
exit_code, stdout, stderr = self.transport.execute_command(cmd)
if exit_code != 0 or stderr:
errmsg = (
"Error creating temporary directory `{0}` on host `{1}`:"
" {2} (exit code {3})"
.format(target, self.frontend, stderr, exit_code))
raise gc3libs.exceptions.LRMSSubmitError(errmsg, do_log=True)
raise gc3libs.exceptions.SpoolDirError(
"Cannot create temporary job working directory"
" `{0}` on host `{1}`; command `{2}` exited"
" with code {3} and error output: '{4}'."
.format(target, self.frontend, cmd, exit_code, stderr))
return stdout.strip()

def _stage_app_input_files(self, app):
Expand Down

0 comments on commit 92e4203

Please sign in to comment.