Skip to content

Commit

Permalink
Merge pull request #167 from ReactionMechanismGenerator/better_err_msg
Browse files Browse the repository at this point in the history
Better error message for command error on server
  • Loading branch information
alongd committed Aug 7, 2019
2 parents 146bca0 + 8c85a24 commit bd44805
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion arc/job/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

from arc.job.ssh import check_job_status_in_stdout
from arc.settings import servers, check_status_command, submit_command, submit_filename, delete_command, output_filename
from arc.arc_exceptions import SettingsError

##################################################################

Expand All @@ -29,7 +30,15 @@ def execute_command(command, shell=True):
"""
if not isinstance(command, list) and not shell:
command = [command]
stdout = subprocess.check_output(command, shell=shell)
try:
stdout = subprocess.check_output(command, shell=shell)
except subprocess.CalledProcessError as e:
logger.error('The following command is erroneous:\n{0}'.format(e.message))
raise SettingsError('The following command is erroneous: \n{0}'
'\nTo correct the command, modify settings.py'
'\nTips: use "which" command to locate cluster software commands on server.'
'\nExample: type "which sbatch" on a server running Slurm to find the correct'
' sbatch path required in the submit_command dictionary.'.format(e.message))
return stdout.splitlines(), ''


Expand Down

0 comments on commit bd44805

Please sign in to comment.