Skip to content

Commit

Permalink
only fail environment checks if there is an error
Browse files Browse the repository at this point in the history
  • Loading branch information
rchan26 committed Apr 17, 2024
1 parent 62fa11c commit 3fd40f4
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/batch_llm/scripts/run_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,25 +168,30 @@ def is_valid_jsonl(
for model in model_environments_to_check:
environment_issues.extend(ASYNC_MODELS[model].check_environment_variables())

if not valid_indicator:
log_msg = f"File {file_path} is an invalid jsonl file"
if len(environment_issues) != 0:
if not all(isinstance(item, Warning) for item in environment_issues):
valid_indicator = False
log_msg = (
f"File {file_path} has the following environment variables "
f"that aren't set: {environment_issues}"
)
write_log_message(log_file=log_file, log_message=log_msg)
else:
logging.info(f"File {file_path} is a valid jsonl file")

if len(multimedia_path_errors) != 0:
valid_indicator = False
log_msg = (
f"File {file_path} includes the following multimedia paths "
f"that do not exist: {multimedia_path_errors}"
)
write_log_message(log_file=log_file, log_message=log_msg)

if len(environment_issues) != 0:
log_msg = (
f"File {file_path} has the following environment variables "
f"that aren't set: {environment_issues}"
)
if not valid_indicator:
log_msg = f"File {file_path} is an invalid jsonl file"
write_log_message(log_file=log_file, log_message=log_msg)
else:
logging.info(
f"File {file_path} is a valid jsonl file. But check if there's any warnings in the logs"
)

return valid_indicator

Expand Down

0 comments on commit 3fd40f4

Please sign in to comment.