Skip to content

Commit 0879ca5

Browse files
authored
Merge pull request #265 from sbintuitions/add-flexeval-lm-exit-code
Add exit code to flexeval_lm
2 parents 0c43c77 + 7f6326a commit 0879ca5

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

flexeval/scripts/flexeval_lm.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ def main() -> None: # noqa: C901, PLR0912, PLR0915
261261
)
262262
)
263263

264+
exit_code = os.EX_OK
264265
# run evaluation
265266
for eval_setup, eval_setup_config, group in eval_setups_and_metadata:
266267
logger.info(f"Evaluating with the setup: {eval_setup_config}")
@@ -305,6 +306,9 @@ def main() -> None: # noqa: C901, PLR0912, PLR0915
305306
logger.error(
306307
f"Error in evaluation:\n{e}\n{stack_trace_str}",
307308
)
309+
exit_code = os.EX_DATAERR
310+
311+
sys.exit(exit_code)
308312

309313

310314
if __name__ == "__main__":

tests/scripts/test_flexeval_lm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ def test_if_cli_raises_error_when_save_data_exists(command: list[str]) -> None:
234234
config_file = Path(f) / CONFIG_FILE_NAME
235235
config_file.touch()
236236
result = subprocess.run([*command, "--save_dir", f], check=False)
237-
assert result.returncode == os.EX_OK
237+
assert result.returncode == os.EX_DATAERR
238238
# check if config_file is not modified and empty
239239
assert config_file.read_text() == ""
240240

0 commit comments

Comments
 (0)