Skip to content

Commit

Permalink
Modified run return code based on checks source
Browse files Browse the repository at this point in the history
Signed-off-by: Wei-Chun, Chang <wcchang@infuseai.io>
  • Loading branch information
wcchang1115 committed Sep 25, 2024
1 parent 7919a3e commit 51b2fc6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions recce/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def process_failed_checks(failed_checks: List[dict], error_log=None):
if error_log:
with open(error_log, 'w') as f:
f.write(content)
print('The failed checks are stored at [{}]'.format(error_log))
print(f"The failed checks are stored at '{error_log}'")
else:
print(content, file=sys.stderr)

Expand Down Expand Up @@ -237,6 +237,7 @@ async def cli_run(output_state_file: str, **kwargs):
console.rule("Preset checks")
rc, failed_checks = await execute_preset_checks(preset_checks)
if rc != 0 and failed_checks:
console.print("[[yellow]Warning[/yellow]] Some preset checks failed. Please see the failed reason.")
process_failed_checks(failed_checks, error_log)
else:
state_checks = ctx.state_loader.state.checks
Expand All @@ -245,8 +246,9 @@ async def cli_run(output_state_file: str, **kwargs):
pass
else:
console.rule("Checks")
rc, failed_checks = await execute_state_checks(state_checks)
if rc != 0 and failed_checks:
_, failed_checks = await execute_state_checks(state_checks)
if failed_checks:
console.print("[[yellow]Warning[/yellow]] Some checks failed. Please see the failed reason.")
process_failed_checks(failed_checks, error_log)

from recce.event import log_load_state
Expand Down

0 comments on commit 51b2fc6

Please # to comment.