File tree Expand file tree Collapse file tree 3 files changed +4
-22
lines changed
Expand file tree Collapse file tree 3 files changed +4
-22
lines changed Original file line number Diff line number Diff line change 5454 cmdstan_version_before ,
5555 do_command ,
5656 get_logger ,
57- returncode_msg ,
5857)
5958from cmdstanpy .utils .filesystem import (
6059 temp_inits ,
@@ -2162,14 +2161,13 @@ def _timer_target() -> None:
21622161 get_logger ().info ('%s done processing' , logger_prefix )
21632162
21642163 if retcode != 0 :
2165- retcode_summary = returncode_msg (retcode )
21662164 serror = ''
21672165 try :
21682166 serror = os .strerror (retcode )
21692167 except (ArithmeticError , ValueError ):
21702168 pass
21712169 get_logger ().error (
2172- ' %s error: %s %s' , logger_prefix , retcode_summary , serror
2170+ " %s error: code '%d' %s" , logger_prefix , retcode , serror
21732171 )
21742172
21752173 @staticmethod
Original file line number Diff line number Diff line change 2020 validate_dir ,
2121 wrap_url_progress_hook ,
2222)
23- from .command import do_command , returncode_msg
23+ from .command import do_command
2424from .data_munging import build_xarray_data , flatten_chains
2525from .filesystem import (
2626 SanitizedOrTmpFilePath ,
@@ -114,7 +114,6 @@ def show_versions(output: bool = True) -> str:
114114 'parse_rdump_value' ,
115115 'pushd' ,
116116 'read_metric' ,
117- 'returncode_msg' ,
118117 'rload' ,
119118 'set_cmdstan_path' ,
120119 'set_make_env' ,
Original file line number Diff line number Diff line change @@ -71,25 +71,10 @@ def do_command(
7171 serror = os .strerror (proc .returncode )
7272 except (ArithmeticError , ValueError ):
7373 pass
74- msg = ' Command {}\n \t {} {}' .format (
75- cmd , returncode_msg ( proc .returncode ) , serror
74+ msg = " Command {}\n \t exited with code '{}' {}" .format (
75+ cmd , proc .returncode , serror
7676 )
7777 raise RuntimeError (msg )
7878 except OSError as e :
7979 msg = 'Command: {}\n failed with error {}\n ' .format (cmd , str (e ))
8080 raise RuntimeError (msg ) from e
81-
82-
83- def returncode_msg (retcode : int ) -> str :
84- """interpret retcode"""
85- if retcode < 0 :
86- sig = - 1 * retcode
87- return f'terminated by signal { sig } '
88- if retcode <= 125 :
89- return 'error during processing'
90- if retcode == 126 : # shouldn't happen
91- return ''
92- if retcode == 127 :
93- return 'program not found'
94- sig = retcode - 128
95- return f'terminated by signal { sig } '
You can’t perform that action at this time.
0 commit comments